From dc07b4973b999f6a5beadee9ef1ee88f3b572bfc Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 13 Jun 2023 08:53:17 +0200 Subject: [PATCH] add datastorage to csv --- .../resources/documents/device_row.py | 15 +++++++++++++-- .../templates/inventory/erasure_list.html | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/documents/device_row.py b/ereuse_devicehub/resources/documents/device_row.py index b9d6c219..31867a64 100644 --- a/ereuse_devicehub/resources/documents/device_row.py +++ b/ereuse_devicehub/resources/documents/device_row.py @@ -345,6 +345,9 @@ class DeviceRow(BaseDeviceRow): self['IMEI'] = device.imei or '' self.get_erasure_datawipe_mobile(device) + if isinstance(device, d.DataStorage): + self.get_erasure_datawipe_mobile(device) + def components(self): """Function to get all components information of a device.""" assert isinstance(self.device, d.Computer) @@ -424,8 +427,16 @@ class DeviceRow(BaseDeviceRow): erasure = erasures[-1] if erasures else None if erasure: self['Erasure DataStorage 1'] = none2str(device.chid) - serial_number = none2str(device.imei) - storage_size = none2str(device.data_storage_size) + if isinstance(device, d.Mobile): + serial_number = none2str(device.imei) + size = device.data_storage_size + size = size * 1000 if size else 0 + storage_size = none2str(size) + + if isinstance(device, d.DataStorage): + serial_number = none2str(device.serial_number) + storage_size = none2str(device.size) + self['Erasure DataStorage 1 Serial Number'] = serial_number self['Erasure DataStorage 1 Size (MB)'] = storage_size self['Erasure DataStorage 1 Software'] = erasure.document.software diff --git a/ereuse_devicehub/templates/inventory/erasure_list.html b/ereuse_devicehub/templates/inventory/erasure_list.html index 0e57e9f9..2449686b 100644 --- a/ereuse_devicehub/templates/inventory/erasure_list.html +++ b/ereuse_devicehub/templates/inventory/erasure_list.html @@ -162,6 +162,7 @@ {% for ac in erasure.items %} + {% if not ac.device.is_mobile() %} + {% endif %} {% endfor %}