Reverts temporarilty the propagation of values for

devices until a clear Device registration strategy takes place
This commit is contained in:
emmdim 2020-03-20 15:48:40 +01:00
parent bd396f0642
commit 4f6eb00d3a
1 changed files with 9 additions and 9 deletions

View File

@ -42,17 +42,17 @@ class DeliverynoteView(View):
'ethereum_address'), partial=True) 'ethereum_address'), partial=True)
d = request.get_json(schema=patch_schema) d = request.get_json(schema=patch_schema)
dlvnote = Deliverynote.query.filter_by(id=id).one() dlvnote = Deliverynote.query.filter_by(id=id).one()
device_fields = ['transfer_state', 'deliverynote_address'] # device_fields = ['transfer_state', 'deliverynote_address']
computers = [x for x in dlvnote.transferred_devices if isinstance(x, Computer)] # computers = [x for x in dlvnote.transferred_devices if isinstance(x, Computer)]
for key, value in d.items(): for key, value in d.items():
# Transalate ethereum_address attribute
devKey = key
if key == 'ethereum_address':
devKey = 'deliverynote_address'
setattr(dlvnote, key, value) setattr(dlvnote, key, value)
if devKey in device_fields: # Transalate ethereum_address attribute
for dev in computers: # devKey = key
setattr(dev, devKey, value) # if key == 'ethereum_address':
# devKey = 'deliverynote_address'
# if devKey in device_fields:
# for dev in computers:
# setattr(dev, devKey, value)
db.session.commit() db.session.commit()
return Response(status=204) return Response(status=204)