This commit is contained in:
Cayo Puigdefabregas 2023-03-10 20:13:54 +01:00
parent 1c82fcfa30
commit ba02351f59
2 changed files with 11 additions and 54 deletions

View File

@ -1022,16 +1022,17 @@ class Device(Thing):
return return
def get_set_lots(self): def get_set_lots(self):
if self.lots: if hasattr(self, "orphan") and self.orphan:
if self.binding:
return set(self.binding.device.lots)
return set(self.lots) return set(self.lots)
if hasattr(self, "parent") and self.parent and self.parent.lots: if hasattr(self, "parent") and self.parent:
if self.parent.binding:
return set(self.parent.binding.device.lots)
return set(self.parent.lots) return set(self.parent.lots)
if self.binding: return set(self.lots)
return self.binding.device.get_set_lots()
return set()
def __lt__(self, other): def __lt__(self, other):
return self.id < other.id return self.id < other.id

View File

@ -161,7 +161,7 @@
{% if erasure_hosts %} {% if erasure_hosts %}
<tr style="padding-top:5px;"> <tr style="padding-top:5px;">
<td style="width:20%;"> <td style="width:20%;">
<span>N&deg; of sanitization server {{ erasure_hosts|length }}:</span> <span>SNs; of sanitization server {{ erasure_hosts|length }}:</span>
</td> </td>
<td style="width:80%;"> <td style="width:80%;">
{% for e in erasure_hosts %} {% for e in erasure_hosts %}
@ -267,14 +267,9 @@
</div> </div>
{% if erasures %} {% if erasures %}
{% if erasure_hosts %}
{% for server in erasure_hosts %}
<div class="row mt-3 page-break"> <div class="row mt-3 page-break">
<div class="col"> <div class="col">
<h1>Server Summary</h1> <h1>Summary</h1>
</div>
<div class="col">
<h4>SN Server {{ server.serial_number and server.serial_number.upper() }}</h4>
</div> </div>
</div> </div>
<div class="row mt-3"> <div class="row mt-3">
@ -283,6 +278,7 @@
<thead style="border-bottom: 1px solid #000;"> <thead style="border-bottom: 1px solid #000;">
<tr> <tr>
<th scope="col" style="text-align: center;">SN Storage</th> <th scope="col" style="text-align: center;">SN Storage</th>
<th scope="col" style="text-align: center;">SN Host</th>
<th scope="col" style="text-align: center;">Method</th> <th scope="col" style="text-align: center;">Method</th>
<th scope="col" style="text-align: center;">Result</th> <th scope="col" style="text-align: center;">Result</th>
<th scope="col" style="text-align: center;">Date</th> <th scope="col" style="text-align: center;">Date</th>
@ -290,51 +286,12 @@
</thead> </thead>
<tbody> <tbody>
{% for erasure in erasures %} {% for erasure in erasures %}
{% if erasure.parent == server %}
<tr style="border-bottom: 1px dashed #000;"> <tr style="border-bottom: 1px dashed #000;">
<td> <td>
{{ erasure.device.serial_number.upper() }} {{ erasure.device.serial_number.upper() }}
</td> </td>
<td> <td>
{{ erasure.get_public_name() }} {{ erasure.parent.serial_number.upper() }}
</td>
<td>
{{ erasure.severity.get_public_name() }}
</td>
<td>
{{ erasure.date_str }}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endfor %}
{% endif %}
{% if erasures_normal %}
<div class="row mt-3 page-break">
<div class="col">
<h1>Devices Summary</h1>
</div>
</div>
<div class="row mt-3">
<div class="col">
<table class="table" style="width: 100%; text-align: center;">
<thead style="border-bottom: 1px solid #000;">
<tr>
<th scope="col" style="text-align: center;">SN Storage</th>
<th scope="col" style="text-align: center;">Method</th>
<th scope="col" style="text-align: center;">Result</th>
<th scope="col" style="text-align: center;">Date</th>
</tr>
</thead>
<tbody>
{% for erasure in erasures_normal %}
<tr style="border-bottom: 1px dashed #000;">
<td>
{{ erasure.device.serial_number.upper() }}
</td> </td>
<td> <td>
{{ erasure.get_public_name() }} {{ erasure.get_public_name() }}
@ -351,7 +308,6 @@
</table> </table>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
{% for erasure in erasures %} {% for erasure in erasures %}
<div class="container mb-5 page-break"> <div class="container mb-5 page-break">