Commit 9683e93c authored by Rien's avatar Rien

Split /resto in json and plain version

parent 01fc365a
......@@ -191,7 +191,7 @@ def resto_menu():
resto = requests.get(url).json()
if not resto["open"]:
return mattermost_response('De resto is vandaag gesloten.', ephemeral=True)
return 'De resto is vandaag gesloten.'
else:
def table_for(kind):
items = [meal for meal in resto["meals"] if meal["kind"] == kind]
......@@ -222,15 +222,16 @@ def resto_menu():
{vegetable_table}
"""
return mattermost_response(template.format(
return template.format(
soup_table=table_for("soup"),
meat_table=table_for("meat"),
fish_table=table_for("fish"),
vegi_table=table_for("vegetarian"),
vegetable_table="\n".join(resto["vegetables"])
), ephemeral = True)
)
@app.route('/resto.json', methods=['GET'])
def resto_menu_json():
return mattermost_response(resto_menu(), ephemeral=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment