diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-04 16:37:11 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2010-05-04 16:37:11 +0200 |
commit | 7861d3979a91e739522150667171611987856e9b (patch) | |
tree | f4ebd333dbc9e7a7555a11933e685331e94fb147 | |
parent | fc2b648989cd5afaff3c563dea739e90c19be331 (diff) | |
download | kosten-7861d3979a91e739522150667171611987856e9b.tar.gz kosten-7861d3979a91e739522150667171611987856e9b.tar.bz2 kosten-7861d3979a91e739522150667171611987856e9b.zip |
Constant expenses should only be regarded with their monthly part
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)) |