From b118edb0a9d83ccfb0423a72447bf644dcd1495a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 19 Sep 2022 12:10:34 +0200 Subject: [PATCH] erasure only one time for row and disk --- ereuse_devicehub/resources/documents/device_row.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ereuse_devicehub/resources/documents/device_row.py b/ereuse_devicehub/resources/documents/device_row.py index d22ee8f1..ef2f5628 100644 --- a/ereuse_devicehub/resources/documents/device_row.py +++ b/ereuse_devicehub/resources/documents/device_row.py @@ -1,6 +1,7 @@ """ This file frame a correct row for csv report """ from collections import OrderedDict + from flask import url_for from ereuse_devicehub.resources.action.models import RateComputer @@ -633,6 +634,7 @@ class InternalStatsRow(OrderedDict): # Live self.actions = actions year, month = create.split('-') + self.disks = [] self['User'] = user self['Year'] = year @@ -662,7 +664,10 @@ class InternalStatsRow(OrderedDict): def is_erase(self, ac): if ac.type in ['EraseBasic', 'EraseSectors']: + if ac.device in self.disks: + return ac self['Drives Erasure'] += 1 + self.disks.append(ac.device) return ac def is_live(self, ac):