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 = [] zamowienia = []
for i in range(6): for i in range(6):
zamowienie = [] zamowienie = []
for j in range(2): for j in range(random.randint(1, 5)):
zamowienie.append(meals[random.randint(0, len(meals)-1)]) zamowienie.append(meals[random.randint(0, len(meals)-1)])
zamowienia.append(Zamowienie(i+1, zamowienie)) zamowienia.append(Zamowienie(i+1, zamowienie))
i=0
for stolik in stoliki: 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) klient.zloz_zamowienie(zamowienia[random.randint(0, len(zamowienia)-1)], stolik)

View File

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