summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/mensa.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/mensa.py b/modules/mensa.py
index 4867670..d8ee447 100644
--- a/modules/mensa.py
+++ b/modules/mensa.py
@@ -79,7 +79,7 @@ class Module(ModuleBase):
row = handle_data_row(data, pos)
if not row:
- return False
+ break
meals.append(row[0])
pos = row[1]
@@ -113,6 +113,12 @@ class Module(ModuleBase):
stripunescape = (lambda item: (unescape(item[0].strip()), unescape(item[1].strip())))
meals = map(lambda item: map(stripunescape, item), meals)
+ if len(meals) == 0:
+ return False
+
+ while len(meals) < 6:
+ meals.insert(len(meals)-1, [[None], [None], [None], [None], [None]])
+
reply = 'Mensa-Menü für den %s\n\n' % day.strftime('%d.%m.%y')
if meals[0][weekday][0]:
reply += 'Eintopf: %s (%s)\n' % meals[0][weekday]
@@ -122,10 +128,10 @@ class Module(ModuleBase):
reply += 'Hauptgericht 2: %s (%s)\n' % meals[3][weekday]
if meals[2][weekday][0]:
reply += 'Vegetarisches Hauptgericht: %s (%s)\n' % meals[2][weekday]
- #if meals[4][weekday][0]:
- # reply += 'Wok: %s (%s)\n' % meals[4][weekday]
if meals[4][weekday][0]:
- reply += 'Beilagen: %s (%s)\n' % meals[4][weekday]
+ reply += 'Wok: %s (%s)\n' % meals[4][weekday]
+ if meals[5][weekday][0]:
+ reply += 'Beilagen: %s (%s)\n' % meals[5][weekday]
return reply