From 44ba18d22e125e7ac7d08df19c3b9c2ae2d725c8 Mon Sep 17 00:00:00 2001 From: Yingtong Li Date: Tue, 17 Nov 2020 19:06:19 +1100 Subject: [PATCH] Allow fractional units --- sstreasury/models.py | 4 ++-- 1 file 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