Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Convert floats to string before converting to decimal...

Roland Geider18f15e3281b2
diff --git a/wger/manager/models.py b/wger/manager/models.py
index 7dff903ce..9d8ba62ee 100644
--- a/wger/manager/models.py
+++ b/wger/manager/models.py
@@ -725,7 +725,7 @@ by the US Department of Agriculture. It is extremely complete, with around
# Any of the entries is missing
rate = 0
- return decimal.Decimal(rate).quantize(decimal.Decimal('.01'))
+ return decimal.Decimal(str(rate)).quantize(decimal.Decimal('.01'))
def calculate_activities(self):
'''
@@ -767,7 +767,7 @@ by the US Department of Agriculture. It is extremely complete, with around
# Total
total = (sleep + work + sport + freetime) / 24.0
- return decimal.Decimal(total).quantize(decimal.Decimal('.01'))
+ return decimal.Decimal(str(total)).quantize(decimal.Decimal('.01'))
# Every new user gets a profile