From 24b59a920e6ea706670509acf858019c3976f190 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 18 Jul 2023 16:31:21 +0200 Subject: [PATCH] . --- ereuse_devicehub/inventory/forms.py | 1 + ereuse_devicehub/parser/schemas.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index 878c0532..24726a46 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -329,6 +329,7 @@ class UploadSnapshotForm(SnapshotMixin, FlaskForm): self.version = snapshot_json.get('schema_api') self.uuid = snapshot_json.get('uuid') self.sid = snapshot_json.get('sid') + # import pdb; pdb.set_trace() if snapshot_json.get('hwmd'): schema_api = snapshot_json.get('schema_api') diff --git a/ereuse_devicehub/parser/schemas.py b/ereuse_devicehub/parser/schemas.py index 12ba2ad0..4dbdb106 100644 --- a/ereuse_devicehub/parser/schemas.py +++ b/ereuse_devicehub/parser/schemas.py @@ -27,21 +27,23 @@ class Test(MarshmallowSchema): class Steps(MarshmallowSchema): num = Integer(data_key='step', required=True) - start_time = DateTime(data_key='date_init', required=True) - end_time = DateTime(data_key='date_end', required=True) + start_time = DateTime(data_key='date_init', required=False) + end_time = DateTime(data_key='date_end', required=False) severity = EnumField(Severity) @pre_load def preload_datas(self, data: dict): data['severity'] = Severity.Info.name - - if not data.pop('success', False): - data['severity'] = Severity.Error.name data.pop('duration', None) data.pop('commands', None) + if not data.pop('success', False): + data['severity'] = Severity.Error.name + if data.get('date_init'): data['date_init'] = datetime.fromtimestamp(data['date_init']).isoformat() + + if data.get('date_end'): data['date_end'] = datetime.fromtimestamp(data['date_end']).isoformat()