diff --git a/app/routers/home.py b/app/routers/home.py index 5b19d37..a7a1704 100644 --- a/app/routers/home.py +++ b/app/routers/home.py @@ -65,6 +65,12 @@ async def home(request: Request): stats["storage"] = len(storage_providers) if storage_providers else 0 except Exception: pass + try: + from ..dependencies import get_cache_manager + effects = get_cache_manager().list_by_type('effect') + stats["effects"] = len(effects) + except Exception: + pass templates = get_templates(request) return render(templates, "home.html", request, diff --git a/app/templates/home.html b/app/templates/home.html index 8189268..c6a23aa 100644 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -7,7 +7,7 @@

Art-DAG L1

Content-Addressable Media Processing

-
+
{{ stats.runs or 0 }}
@@ -18,6 +18,11 @@
{{ stats.recipes or 0 }}
Recipes
+ +
{{ stats.effects or 0 }}
+
Effects
+
{{ stats.media or 0 }}
diff --git a/tests/test_effects_web.py b/tests/test_effects_web.py index c17701e..5ad461f 100644 --- a/tests/test_effects_web.py +++ b/tests/test_effects_web.py @@ -235,6 +235,28 @@ def process_frame(frame, params, state): assert "multi-line" in meta["description"] +class TestHomePageEffectsCount: + """Test that effects count is shown on home page.""" + + def test_home_template_has_effects_card(self) -> None: + """Home page should display effects count.""" + path = Path('/home/giles/art/art-celery/app/templates/home.html') + content = path.read_text() + + assert 'stats.effects' in content, \ + "Home page should display stats.effects count" + assert 'href="/effects"' in content, \ + "Home page should link to /effects" + + def test_home_route_provides_effects_count(self) -> None: + """Home route should provide effects count in stats.""" + path = Path('/home/giles/art/art-celery/app/routers/home.py') + content = path.read_text() + + assert 'stats["effects"]' in content, \ + "Home route should populate stats['effects']" + + class TestNavigationIncludesEffects: """Test that Effects link is in navigation."""