Merge pull request #149 from eReuse/feature/endpoint-confirm

Feature/endpoint confirm
This commit is contained in:
cayop 2021-06-11 13:06:21 +02:00 committed by GitHub
commit cbca278fae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1008 additions and 1 deletions

View File

@ -224,6 +224,7 @@ class LotDeviceView(LotBaseChildrenView):
id = ma.fields.List(ma.fields.Integer()) id = ma.fields.List(ma.fields.Integer())
def _post(self, lot: Lot, ids: Set[int]): def _post(self, lot: Lot, ids: Set[int]):
# import pdb; pdb.set_trace()
# get only new devices # get only new devices
ids -= {x.id for x in lot.devices} ids -= {x.id for x in lot.devices}
if not ids: if not ids:
@ -233,7 +234,7 @@ class LotDeviceView(LotBaseChildrenView):
if lot.trade: if lot.trade:
# all users involved in the trade action can modify the lot # all users involved in the trade action can modify the lot
trade_users = [lot.trade.user_from.id, lot.trade.user_to.id] trade_users = [lot.trade.user_from.id, lot.trade.user_to.id]
if g.user in trade_users: if g.user.id in trade_users:
users = trade_users users = trade_users
devices = set(Device.query.filter(Device.id.in_(ids)).filter( devices = set(Device.query.filter(Device.id.in_(ids)).filter(

File diff suppressed because it is too large Load Diff