[pricelist] fix bug set no volumes are set
This commit is contained in:
parent
32ad4471c6
commit
0630b5183d
|
@ -188,7 +188,8 @@ def update_drink(identifier, data):
|
||||||
if drink_type:
|
if drink_type:
|
||||||
drink.type = drink_type
|
drink.type = drink_type
|
||||||
if volumes is not None and session.user_.has_permission(EDIT_VOLUME):
|
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:
|
if len(tags) > 0:
|
||||||
drink.tags = tags
|
drink.tags = tags
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -197,11 +198,13 @@ def update_drink(identifier, data):
|
||||||
raise BadRequest
|
raise BadRequest
|
||||||
|
|
||||||
|
|
||||||
def set_volumes(volumes, drink):
|
def set_volumes(volumes):
|
||||||
|
retVal = []
|
||||||
if not isinstance(volumes, list):
|
if not isinstance(volumes, list):
|
||||||
raise BadRequest
|
raise BadRequest
|
||||||
for volume in volumes:
|
for volume in volumes:
|
||||||
drink.volumes.append(set_volume(volume))
|
retVal.append(set_volume(volume))
|
||||||
|
return retVal
|
||||||
|
|
||||||
|
|
||||||
def delete_drink(identifier):
|
def delete_drink(identifier):
|
||||||
|
|
Loading…
Reference in New Issue