fix: Fixed diet_restriction

This commit is contained in:
Patryk Olszewski 2024-04-11 15:44:45 +02:00
parent c2b3944373
commit ebb834cc81
3 changed files with 18 additions and 13 deletions

View File

@ -1 +1 @@
Projekt na Sztuczną Inteligencje, semstr letnim, 2024
Projekt na Sztuczną Inteligencje, semestr letni, 2024

View File

@ -124,13 +124,14 @@ for i in range(3):
zamowienia = []
for i in range(6):
zamowienie = []
for j in range(2):
for j in range(random.randint(1, 5)):
zamowienie.append(meals[random.randint(0, len(meals)-1)])
zamowienia.append(Zamowienie(i+1, zamowienie))
i=0
for stolik in stoliki:
klient = clients[random.randint(0, len(clients)-1)]
klient = clients[i%len(clients)]
i=i+1
klient.zloz_zamowienie(zamowienia[random.randint(0, len(zamowienia)-1)], stolik)

View File

@ -1,14 +1,18 @@
def diet_restriction(meals,client):
flag = True
print(client.restrykcje_dietowe)
for meal in meals:
vegan,vegetarian,meat = meal.vegan_vegetarian_meat
print(meal)
print(client.restrykcje_dietowe)
if vegan and client.restrykcje_dietowe == 'Vegan':
return True
elif vegetarian and (client.restrykcje_dietowe == 'Vegetarian' or meat and client.restrykcje_dietowe == 'Vegan'):
return True
elif client.restrykcje_dietowe == 'Meat':
return True
else:
return False
if not vegan and client.restrykcje_dietowe == 'Vegan':
print("tu")
flag = False
elif client.restrykcje_dietowe == 'Vegetarian' and meat:
print("tu2")
flag = False
print("----------------------------------")
return flag