From 41e66b09629837d9d2ce67e0d0e49d0f9efd0dae Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 10 Nov 2024 01:24:51 +0100 Subject: [PATCH] fix: property/value stringification --- lelcsc/core/models/component.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lelcsc/core/models/component.py b/lelcsc/core/models/component.py index 0ce960b..e910096 100644 --- a/lelcsc/core/models/component.py +++ b/lelcsc/core/models/component.py @@ -23,8 +23,8 @@ class Property(models.Model): ) def __str__(self): - return ( - self.name + f" [{self.unit}]" if self.type == Property.Type.QUANTITY else "" + return self.name + ( + f" [{self.unit}]" if self.type == Property.Type.QUANTITY else "" ) @@ -48,13 +48,13 @@ class Value(models.Model): def __str__(self): match self.property.type: case Property.Type.QUANTITY: - s = str(integer) + s = str(self.integer) scale = self.property.scale if scale > 0: s += "0" * scale elif scale < 0: - s = str(integer).rjust(abs(scale) + 1, "0") + s = str(self.integer).rjust(abs(scale) + 1, "0") s = s[:scale] + "." + s[scale:] return f"{s} {self.property.unit}"