Fix recipe list links and home page recipe count

- Template used recipe.id but service returns recipe.recipe_id
- Add recipe count to home page stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 17:26:00 +00:00
parent a6fe88c277
commit 3373be285e
2 changed files with 9 additions and 1 deletions

View File

@@ -40,6 +40,14 @@ async def home(request: Request):
stats["media"] = await database.count_user_items(user.actor_id)
except Exception:
pass
try:
from ..services.recipe_service import RecipeService
from ..dependencies import get_redis_client, get_cache_manager
recipe_service = RecipeService(get_redis_client(), get_cache_manager())
recipes = await recipe_service.list_recipes(user.actor_id)
stats["recipes"] = len(recipes)
except Exception:
pass
templates = get_templates(request)
return render(templates, "home.html", request,

View File

@@ -15,7 +15,7 @@
{% if recipes %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{% for recipe in recipes %}
<a href="/recipe/{{ recipe.id }}"
<a href="/recipe/{{ recipe.recipe_id }}"
class="bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-gray-600 transition-colors">
<div class="flex items-center justify-between mb-2">
<span class="font-medium text-white">{{ recipe.name }}</span>