From 0630b5183d9a0a4908580049515628cd4cebfec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 15 Apr 2021 15:23:37 +0200 Subject: [PATCH] [pricelist] fix bug set no volumes are set --- flaschengeist/plugins/pricelist/pricelist_controller.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flaschengeist/plugins/pricelist/pricelist_controller.py b/flaschengeist/plugins/pricelist/pricelist_controller.py index ca18aaf..1c1491e 100644 --- a/flaschengeist/plugins/pricelist/pricelist_controller.py +++ b/flaschengeist/plugins/pricelist/pricelist_controller.py @@ -188,7 +188,8 @@ def update_drink(identifier, data): if drink_type: drink.type = drink_type if volumes is not None and session.user_.has_permission(EDIT_VOLUME): - set_volumes(volumes, drink) + drink.volumes = [] + drink.volumes = set_volumes(volumes) if len(tags) > 0: drink.tags = tags db.session.commit() @@ -197,11 +198,13 @@ def update_drink(identifier, data): raise BadRequest -def set_volumes(volumes, drink): +def set_volumes(volumes): + retVal = [] if not isinstance(volumes, list): raise BadRequest for volume in volumes: - drink.volumes.append(set_volume(volume)) + retVal.append(set_volume(volume)) + return retVal def delete_drink(identifier):