[pricelist][fix] better query to send drinks with public prices
This commit is contained in:
parent
e4b937991b
commit
1bb7bafa2a
|
@ -143,6 +143,8 @@ def get_drinks(
|
|||
query = query.filter(Drink.cost_per_volume >= 0)
|
||||
if receipt:
|
||||
query = query.filter(Drink.volumes.any(DrinkPriceVolume.ingredients != None))
|
||||
if public:
|
||||
query = query.filter(Drink.volumes.any(DrinkPriceVolume.prices.any(DrinkPrice.public)))
|
||||
if search_name:
|
||||
if search_key == "name":
|
||||
query = query.filter(Drink.name.contains(search_name))
|
||||
|
@ -166,8 +168,6 @@ def get_drinks(
|
|||
if offset is not None:
|
||||
query = query.offset(offset)
|
||||
drinks = query.all()
|
||||
if public:
|
||||
return [_create_public_drink(drink) for drink in drinks if _create_public_drink(drink)], count
|
||||
return drinks, count
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue