diff options
Diffstat (limited to '')
-rw-r--r-- | controller.py | 2 | ||||
-rw-r--r-- | model.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/controller.py b/controller.py index 0957692..73f0fc8 100644 --- a/controller.py +++ b/controller.py @@ -27,7 +27,7 @@ class Show: def calc(self, year, month): ssum = sql.functions.sum(SingleExpense.expense) - csum = sql.functions.sum(ConstExpense.expense) + csum = sql.functions.sum(ConstExpense.monthly) query = SingleExpense.of_month(month, year).\ group_by(SingleExpense.category_id).\ @@ -72,7 +72,7 @@ class ConstExpense (Expense): next = OneToOne('ConstExpense', inverse = 'prev') prev = ManyToOne('ConstExpense') - monthly = ColumnProperty(lambda c: c.expense / c.months, deferred = True) + monthly = ColumnProperty(lambda c: sql.cast(c.expense / c.months, T.Numeric(scale = 2)), deferred = True) start_year = ColumnProperty(lambda c: sql.extract('year', c.start)) start_month = ColumnProperty(lambda c: sql.extract('month', c.start)) |