From 40a151df5a434eb3a409ead174792c593035508a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 8 Mar 2023 17:22:26 +0100 Subject: [PATCH] fix order of devices --- ereuse_devicehub/inventory/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 4522c5b5..675409b4 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -1102,6 +1102,12 @@ class ExportsView(View): if "Failed" in [e.severity.get_public_name() for e in erasures]: result = 'Failed' + 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) + erasures_normal = list(set(erasures) - set(erasures_on_server)) + erasures_normal = sorted(erasures_normal, key=lambda x: x.end_time) + params = { 'title': 'Erasure Certificate', 'erasures': tuple(erasures), @@ -1114,7 +1120,7 @@ class ExportsView(View): 'result': result, 'customer_details': customer_details, 'erasure_hosts': erasures_host, - 'erasures_normal': list(set(erasures) - set(erasures_on_server)), + 'erasures_normal': erasures_normal, } return flask.render_template('inventory/erasure.html', **params)