Skip to contentSkip to conversation

Change decimal_places from 31 to 2 in frontend/tko/models.py

PATCH In review Feng Yang 2 participants 2 messages Mar 22, 2010 – Mar 25, 2010 KVM

lore
Share & tools
lore

Feng Yang

author
#0 lore raw

PATCH 1/1 Change decimal_places from 31 to 2 in frontend/tko/models.py

decimal_places must less-than-or-equal-to max_digits in 'numeric(max_digits, decimal_places)' in mysql syntax. max_digits is 12, so decimal_places must <= 12. Set decimal_places to 2.

---
 frontend/tko/models.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
frontend/tko/models.py +1 -1
index 7348b07..abf12b2 100644
@@ -231,7 +231,7 @@ class IterationResult(dbmodels.Model, model_logic.ModelExtensions):
     test = dbmodels.ForeignKey(Test, db_column='test_idx', primary_key=True)
     iteration = dbmodels.IntegerField()
     attribute = dbmodels.CharField(max_length=90)
-    value = dbmodels.DecimalField(null=True, max_digits=12, decimal_places=31,
+    value = dbmodels.DecimalField(null=True, max_digits=12, decimal_places=2,
                                   blank=True)
 
     objects = model_logic.ExtendedManager()
Signature · 1 line
1.5.5.6
#1 lore raw

It looks like iteration_result.value is specified as a FLOAT field in our database. I'd prefer to replace type with dbmodels.FloatField

-James

Quoted 26 lines · Feng Yang

decimal_places must less-than-or-equal-to max_digits in 'numeric(max_digits, decimal_places)' in mysql syntax. max_digits is 12, so decimal_places must <= 12. Set decimal_places to 2.

---
 frontend/tko/models.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
frontend/tko/models.py +0 -0
index 7348b07..abf12b2 100644
@@ -231,7 +231,7 @@ class IterationResult(dbmodels.Model,

model_logic.ModelExtensions):
test = dbmodels.ForeignKey(Test, db_column='test_idx',
primary_key=True)
iteration = dbmodels.IntegerField()
attribute = dbmodels.CharField(max_length=90)
- value = dbmodels.DecimalField(null=True, max_digits=12,
decimal_places=31,
+ value = dbmodels.DecimalField(null=True, max_digits=12,
decimal_places=2,
blank=True)

Quoted 9 lines

objects = model_logic.ExtendedManager()
--
1.5.5.6

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest