fixed proof register

This commit is contained in:
Cayo Puigdefabregas 2023-02-20 11:37:19 +01:00
parent 1907f2508a
commit 599f15d5ae
1 changed files with 5 additions and 4 deletions

View File

@ -901,13 +901,14 @@ class Device(Thing):
from ereuse_devicehub.resources.did.models import PROOF_ENUM, Proof
from ereuse_devicehub.resources.enums import StatusCode
# import pdb; pdb.set_trace()
if result['Status'] == StatusCode.Success:
timestamp = result['Data'].get('data', {}).get('timestamp', time.time())
timestamp = (
result.get('Data', {}).get('data', {}).get('timestamp', time.time())
)
d = {
"type": PROOF_ENUM['Register'],
"device_id": self.id,
"snapshot": self,
"device": self,
"snapshot": [x for x in self.actions if x.t == 'Snapshot'][0],
"timestamp": timestamp,
"issuer_id": g.user.id,
}