fix server report n_computers

This commit is contained in:
Cayo Puigdefabregas 2023-03-09 13:09:05 +01:00
parent 6b0110adda
commit 93d6502a66
2 changed files with 9 additions and 8 deletions

View File

@ -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,

View File

@ -159,19 +159,20 @@
<table class="body_content">
<tbody>
{% if erasure_hosts %}
{% for e in erasure_hosts %}
<tr style="padding-top:5px;">
<td style="width:20%;">
<span>N&deg; of sanitization server ({{ loop.index }}/{{ erasure_hosts|length }}):</span>
<span>N&deg; of sanitization server {{ erasure_hosts|length }}:</span>
</td>
<td style="width:80%;">
{% for e in erasure_hosts %}
{% if e.serial_number %}
<span>{{ e.serial_number.upper() }}</span>
<span>{{ e.serial_number.upper() }}</span>{% if not loop.last %},{% endif %}
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
{% else %}
{% endif %}
{% if n_computers %}
<tr style="padding-top:5px;">
<td style="width:20%;">
<span>N&deg; of computers:</span>
@ -245,7 +246,7 @@
</div>
</div>
<div class="row" style="margin-top:225px;">
<div class="row" style="margin-top:200px;">
<div class="col-12">
<table class="body_content" style="border-top: 1px solid #000;">
<tbody>