diff options
Diffstat (limited to 'app/app.py')
| -rw-r--r-- | app/app.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -253,6 +253,26 @@ def index(): # ── Recipes ─────────────────────────────────────────────────────────────────── +@app.route('/recipes/overview') +def recipes_overview(): + db = database.get_db() + favorites = db.execute( + "SELECT * FROM recipes WHERE status = 'favorited' ORDER BY name" + ).fetchall() + recent = db.execute( + """SELECT * FROM recipes WHERE status != 'ignored' + ORDER BY id DESC LIMIT 12""" + ).fetchall() + db.close() + fav_ids = {r['id'] for r in favorites} + recent_new = [r for r in recent if r['id'] not in fav_ids] + return render_template( + 'recipe_overview.html', + favorites=favorites, recent=recent_new, + cuisine_emoji=CUISINE_EMOJI_MAP, + ) + + SORT_OPTIONS = { 'name': 'name', 'prep': 'prep_time, name', |
