From 1bb7bafa2a69793da05b29f7aa384253e0b5c2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 13 Nov 2021 15:57:49 +0100 Subject: [PATCH] [pricelist][fix] better query to send drinks with public prices --- flaschengeist/plugins/pricelist/pricelist_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flaschengeist/plugins/pricelist/pricelist_controller.py b/flaschengeist/plugins/pricelist/pricelist_controller.py index 0b786a9..3a441f3 100644 --- a/flaschengeist/plugins/pricelist/pricelist_controller.py +++ b/flaschengeist/plugins/pricelist/pricelist_controller.py @@ -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