From 737c8182c33d3fd710724bf71453f008526b9937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 1 Nov 2015 16:03:23 +0100 Subject: List constant expenses ending last month --- app/views/consts.py | 7 ++++++- templates/consts/list.jinja | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/consts.py b/app/views/consts.py index 27386e1..31cf565 100644 --- a/app/views/consts.py +++ b/app/views/consts.py @@ -81,13 +81,18 @@ def list (): current = [] old = [] future = [] + last_month = [] for e in expenses: if e.start <= d: if e.end >= d: current.append(e) else: - old.append(e) + if (d.month == 1 and e.month == 12 and e.year == d.year - 1) \ + or (e.year == d.year and e.month == d.month - 1): + last_month.append(e) + else: + old.append(e) else: future.append(e) diff --git a/templates/consts/list.jinja b/templates/consts/list.jinja index 68fa1e1..7fef344 100644 --- a/templates/consts/list.jinja +++ b/templates/consts/list.jinja @@ -9,6 +9,7 @@ {{ list(current, "Aktuell") }} + {% if last_month %} {{ list(last_month, "Endeten letzten Monat") }} {% endif %} {% if future %} {{ list(future, "Zukünftige") }} {% endif %} {% if old %} {{ list(old, "Veraltet") }} {% endif %} {% endblock %} -- cgit v1.2.3