fixing bug in query

This commit is contained in:
Cayo Puigdefabregas 2020-12-09 12:49:56 +01:00
parent 634806ec1c
commit 16132414e6
1 changed files with 4 additions and 2 deletions

View File

@ -239,10 +239,12 @@ class ActionView(View):
device = snapshot.get('device') # type: Computer device = snapshot.get('device') # type: Computer
# TODO @cayop dependency of pulls 85 # TODO @cayop dependency of pulls 85
# if the pr/85 is merged, then you need change this way for get the device # if the pr/85 is merged, then you need change this way for get the device
if not device.hid or not Device.query.filter(Device.hid==device.hid, owner_id=g.user.id).count(): if not device.hid or not Device.query.filter(
Device.hid==device.hid, Device.owner_id==g.user.id).count():
return None return None
device = Device.query.filter(Device.hid==device.hid, owner_id=g.user.id).one() device = Device.query.filter(
Device.hid==device.hid, Device.owner_id==g.user.id).one()
if not device.allocated: if not device.allocated:
return None return None