Round component parameter values to 3 digits

This commit is contained in:
Mario Hüttel 2022-01-03 22:09:49 +01:00
parent f6a9ce622c
commit f092977b2a

View File

@ -231,10 +231,10 @@ class ComponentParameter(models.Model):
if my_type == 'E' or my_type == 'I':
# Engineering float number
(num, prefix) = NumConv.number_to_engineering(self.value, it_unit=(True if my_type=='I' else False))
return f'{num} {prefix}{self.parameter_type.unit}'
return f'{num:.3f} {prefix}{self.parameter_type.unit}'
elif my_type == 'N':
# Standard float number
return f'{self.value} {self.parameter_type.unit}'
return f'{self.value:.3f} {self.parameter_type.unit}'
elif my_type == 'F':
return self.text_value