Made the mensa module a bit more flexible
This commit is contained in:
parent
ab10b2ae43
commit
b07ceef46b
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Reference in a new issue