Merge pull request #453 from eReuse/changes/4377-setup-page

fix pdf
This commit is contained in:
cayop 2023-05-31 11:19:02 +02:00 committed by GitHub
commit aab3addc20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -501,7 +501,8 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
v += '. ' v += '. '
if 's' in format_spec: if 's' in format_spec:
if self.standards: if self.standards:
std = 'with standards {}'.format(self.standards) standard = ','.join([x.value for x in self.standards])
std = 'with standards {}'.format(standard)
else: else:
std = 'no standard' std = 'no standard'
v += 'Method used: {}, {}. '.format(self.method, std) v += 'Method used: {}, {}. '.format(self.method, std)
@ -527,14 +528,15 @@ class EraseSectors(EraseBasic):
steps_random += 1 steps_random += 1
if s.type == 'StepZero': if s.type == 'StepZero':
steps_zeros += 1 steps_zeros += 1
if steps_zeros < 1:
if steps_zeros == 0 and steps_random == 1:
return "Basic" return "Basic"
if 0 < steps_random < 3: if steps_zeros == 1 and steps_random == 1:
return "Baseline" return "Baseline"
if steps_random > 2: if steps_zeros == 1 and steps_random == 2:
return "Enhanced" return "Enhanced"
return "Basic" return "Custom"
class ErasePhysical(EraseBasic): class ErasePhysical(EraseBasic):

View file

@ -394,6 +394,13 @@ class ErasureStandards(Enum):
isinstance(step, actions.StepRandom) for step in other_steps isinstance(step, actions.StepRandom) for step in other_steps
): ):
standards.add(cls.HMG_IS5) standards.add(cls.HMG_IS5)
if len(other_steps) == 2:
step1 = isinstance(first_step, actions.StepRandom)
step2 = isinstance(other_steps[0], actions.StepZero)
step3 = isinstance(other_steps[1], actions.StepRandom)
if step1 and step2 and step3:
standards.add(cls.HMG_IS5)
return standards return standards