From a95d643755b66d41af0b5532b1cbfb0ad42c1646 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 30 May 2023 11:49:42 +0200 Subject: [PATCH] fix eraseDataWipe in csv --- ereuse_devicehub/resources/documents/device_row.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/documents/device_row.py b/ereuse_devicehub/resources/documents/device_row.py index ba165e0b..aac1f56a 100644 --- a/ereuse_devicehub/resources/documents/device_row.py +++ b/ereuse_devicehub/resources/documents/device_row.py @@ -429,11 +429,14 @@ class DeviceRow(BaseDeviceRow): self['{} {} Size (MB)'.format(ctype, i)] = none2str(component.size) - component_actions = sorted(component.actions, key=lambda x: x.created) + component_actions = [ac for ac in component.actions] + if component.binding: + component_actions.extend(component.binding.device.actions) + component_actions = sorted(component_actions, key=lambda x: x.created) erasures = [ a for a in component_actions - if a.type in ['EraseBasic', 'EraseSectors', 'DataWipe'] + if a.type in ['EraseBasic', 'EraseSectors', 'DataWipe', 'EraseDataWipe'] ] erasure = erasures[-1] if erasures else None if not erasure: @@ -441,7 +444,7 @@ class DeviceRow(BaseDeviceRow): serial_number = none2str(component.serial_number) self['Erasure {} {} Serial Number'.format(ctype, i)] = serial_number self['Erasure {} {} Size (MB)'.format(ctype, i)] = none2str(component.size) - elif hasattr(erasure, 'type') and erasure.type == 'DataWipe': + elif hasattr(erasure, 'type') and erasure.type in ['DataWipe', 'EraseDataWipe']: self['Erasure {} {}'.format(ctype, i)] = none2str(component.chid) serial_number = none2str(component.serial_number) self['Erasure {} {} Serial Number'.format(ctype, i)] = serial_number