summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingtong Li <runassudo@yingtongli.me>2020-11-17 19:06:19 +1100
committerYingtong Li <runassudo@yingtongli.me>2020-11-17 19:06:19 +1100
commit44ba18d22e125e7ac7d08df19c3b9c2ae2d725c8 (patch)
treec369ec66315d0b83ed7d84a84d6827d66576c50a
parent057a97b33a03df3db7f051cab10d71192bcc0391 (diff)
Allow fractional units
-rw-r--r--sstreasury/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sstreasury/models.py b/sstreasury/models.py
index f278dff..8651d1e 100644
--- a/sstreasury/models.py
+++ b/sstreasury/models.py
@@ -100,7 +100,7 @@ class BudgetRevision(models.Model):
def get_revenue_total(self):
total = Decimal(0)
for item in self.revenue:
- total += Decimal(item['Unit price']) * item['Units']
+ total += Decimal(item['Unit price']) * Decimal(item['Units'])
if item['IWT'] and item['Unit price'] > 0:
total -= (Decimal(item['Unit price']) - (Decimal(item['Unit price']) - Decimal('0.8133')) / Decimal('1.01884')) * item['Units']
return total
@@ -108,7 +108,7 @@ class BudgetRevision(models.Model):
def get_expense_total(self):
total = Decimal(0)
for item in self.expense:
- total += Decimal(item['Unit price']) * item['Units']
+ total += Decimal(item['Unit price']) * Decimal(item['Units'])
if not self.expense_no_emergency_fund:
total *= Decimal('1.05')
return total
Contact (issues, pull requests, etc.) at git@yingtongli.me. Generated by cgit.