From deca14befc22a83226b8d3bdeb54d726b1e8bcf4 Mon Sep 17 00:00:00 2001
From: Dirk Sarpe <dsarpe@posteo.de>
Date: Mon, 19 Jun 2017 15:05:01 +0200
Subject: [PATCH] start to work on issue #12

- filter should work
- endtime is in list now, but html needs to be adapted
---
 event_display.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/event_display.py b/event_display.py
index e0bfa0e..cb26084 100644
--- a/event_display.py
+++ b/event_display.py
@@ -14,12 +14,13 @@ period = (now.floor('day'), now.replace(weeks=+2))
 c = Calendar(requests.get(url).text)
 my_list = []
 for e in c.events:
-    if e.begin > period[0] and e.begin < period[1]:
-       my_list.append((e.name, e.begin.format('DD-MM-YYYY HH:mm:ss'), e.location))
+    if e.end > period[0] and e.begin < period[1]:
+       my_list.append((e.name, e.begin.format('DD-MM-YYYY HH:mm:ss'), e.end.format('DD-MM-YYYY HH:mm:ss'), e.location))
 
-event = [my_list[0][0],my_list[1][0],my_list[2][0]]
-begin  = [my_list[0][1],my_list[1][1],my_list[2][1]]
-location = [my_list[0][2],my_list[1][2],my_list[2][2]]
+event    = [my_list[0][0], my_list[1][0], my_list[2][0]]
+begin    = [my_list[0][1], my_list[1][1], my_list[2][1]]
+end      = [my_list[0][2], my_list[1][2], my_list[2][2]]
+location = [my_list[0][3], my_list[1][3], my_list[2][3]]
 
 html_page = """<html xmlns="http://www.w3.org/1999/xhtml">
 
@@ -72,7 +73,7 @@ html_page = """<html xmlns="http://www.w3.org/1999/xhtml">
 </div>
 </body>
 
-</html>""" % (event[0], location[0], begin[0], event[1], location[1], begin[1], event[2], location[2], begin[2])
+</html>""" % (event[0], location[0], begin[0], end[0], event[1], location[1], begin[1], end[1], event[2], location[2], begin[2], end[2])
 
 out_file = open("/home/eventviewer/events/events.html", "w")
 out_file.write(html_page.encode("utf8"))
-- 
GitLab