From 93d6502a66709081d139ea8295f4aa3fa960b32d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 9 Mar 2023 13:09:05 +0100 Subject: [PATCH] fix server report n_computers --- ereuse_devicehub/inventory/views.py | 4 ++-- ereuse_devicehub/templates/inventory/erasure.html | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 081d42c4..89d0bdac 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -1105,9 +1105,9 @@ 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) - # 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) + n_computers = len({x.parent for x in erasures} - erasures_host) params = { 'title': 'Erasure Certificate', @@ -1117,7 +1117,7 @@ class ExportsView(View): 'uuid_report': '{}'.format(uuid.uuid4()), 'software': software, 'my_data': my_data, - 'n_computers': len(set([x.parent for x in erasures])), + 'n_computers': n_computers, 'result': result, 'customer_details': customer_details, 'erasure_hosts': erasures_host, diff --git a/ereuse_devicehub/templates/inventory/erasure.html b/ereuse_devicehub/templates/inventory/erasure.html index c6b40d12..7b8ae650 100644 --- a/ereuse_devicehub/templates/inventory/erasure.html +++ b/ereuse_devicehub/templates/inventory/erasure.html @@ -159,19 +159,20 @@ {% if erasure_hosts %} - {% for e in erasure_hosts %} - {% endfor %} - {% else %} + {% endif %} + {% if n_computers %}
- N° of sanitization server ({{ loop.index }}/{{ erasure_hosts|length }}): + N° of sanitization server {{ erasure_hosts|length }}: + {% for e in erasure_hosts %} {% if e.serial_number %} - {{ e.serial_number.upper() }} + {{ e.serial_number.upper() }}{% if not loop.last %},{% endif %} {% endif %} + {% endfor %}
N° of computers: @@ -245,7 +246,7 @@ -
+