From 6b0110addab6e75f2a3c2878e61c9902f6ccfebb Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 9 Mar 2023 12:40:46 +0100 Subject: [PATCH] fix server report --- ereuse_devicehub/inventory/views.py | 3 ++- ereuse_devicehub/templates/inventory/erasure.html | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 675409b4..081d42c4 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -1097,6 +1097,7 @@ class ExportsView(View): a, b = self.get_server_erasure_hosts(erasures) erasures_host, erasures_on_server = a, b + erasures_host = set(erasures_host) result = 'Success' if "Failed" in [e.severity.get_public_name() for e in erasures]: @@ -1104,7 +1105,7 @@ class ExportsView(View): erasures = sorted(erasures, key=lambda x: x.end_time) erasures_on_server = sorted(erasures_on_server, key=lambda x: x.end_time) - erasures_host = sorted(erasures_host, key=lambda x: x.end_time) + # import pdb; pdb.set_trace() erasures_normal = list(set(erasures) - set(erasures_on_server)) erasures_normal = sorted(erasures_normal, key=lambda x: x.end_time) diff --git a/ereuse_devicehub/templates/inventory/erasure.html b/ereuse_devicehub/templates/inventory/erasure.html index 76df0694..c6b40d12 100644 --- a/ereuse_devicehub/templates/inventory/erasure.html +++ b/ereuse_devicehub/templates/inventory/erasure.html @@ -366,12 +366,14 @@
Hid: {{ erasure.parent.hid }}
Tags: {{ erasure.parent.tags }}
+ {% if erasure.device.parent %}
Computer where it resides:
Title: {{ erasure.device.parent.__format__('ts') }}
DevicehubID: {{ erasure.device.parent.dhid }}
Hid: {{ erasure.device.parent.hid }}
Tags: {{ erasure.device.parent.tags }}
- {% endif %} + {% endif %} + {% endif %}
Erasure:
{{ erasure.__format__('ts') }}