erasure only one time for row and disk

This commit is contained in:
Cayo Puigdefabregas 2022-09-19 12:10:34 +02:00
parent b597fdd372
commit b118edb0a9
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
""" This file frame a correct row for csv report """ """ This file frame a correct row for csv report """
from collections import OrderedDict from collections import OrderedDict
from flask import url_for from flask import url_for
from ereuse_devicehub.resources.action.models import RateComputer from ereuse_devicehub.resources.action.models import RateComputer
@ -633,6 +634,7 @@ class InternalStatsRow(OrderedDict):
# Live # Live
self.actions = actions self.actions = actions
year, month = create.split('-') year, month = create.split('-')
self.disks = []
self['User'] = user self['User'] = user
self['Year'] = year self['Year'] = year
@ -662,7 +664,10 @@ class InternalStatsRow(OrderedDict):
def is_erase(self, ac): def is_erase(self, ac):
if ac.type in ['EraseBasic', 'EraseSectors']: if ac.type in ['EraseBasic', 'EraseSectors']:
if ac.device in self.disks:
return ac
self['Drives Erasure'] += 1 self['Drives Erasure'] += 1
self.disks.append(ac.device)
return ac return ac
def is_live(self, ac): def is_live(self, ac):