From f092977b2a91b9299c700cbb89a3fa224c5e4d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Mon, 3 Jan 2022 22:09:49 +0100 Subject: [PATCH] Round component parameter values to 3 digits --- shimatta_kenkyusho/parts/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shimatta_kenkyusho/parts/models.py b/shimatta_kenkyusho/parts/models.py index 21994b0..075003c 100644 --- a/shimatta_kenkyusho/parts/models.py +++ b/shimatta_kenkyusho/parts/models.py @@ -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