summaryrefslogtreecommitdiff
path: root/controller.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--controller.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/controller.py b/controller.py
index 417046d..e194d22 100644
--- a/controller.py
+++ b/controller.py
@@ -14,7 +14,8 @@ from sqlalchemy import sql
class Show:
def GET(self, year = '', month = ''):
if year:
- return self.render([self.calc(year, month)])
+ c = self.calc(year, month)
+ return self.render([c], self.is_last(c))
else:
d = datetime.date.today()
@@ -24,7 +25,7 @@ class Show:
else:
second = self.calc(d.year, d.month - 1)
- return self.render([first, second])
+ return self.render([first, second], self.is_last(first))
def calc(self, year, month):
@@ -41,8 +42,11 @@ class Show:
return MonthExpense(datetime.date(int(year), int(month), 1), exps)
- def render(self, exps):
- return render("show", exps = exps)
+ def is_last(self, exp):
+ return exp.date >= datetime.date.today().replace(day = 1)
+
+ def render(self, exps, is_last):
+ return render("show", exps = exps, is_last = is_last)
class Add: