Split /resto in json and plain version
This commit is contained in:
parent
01fc365a1e
commit
9683e93cd4
1 changed files with 7 additions and 6 deletions
13
app/app.py
13
app/app.py
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue