From ea08d7e3e8d16ec41568a6e11aa97f0be66b5994 Mon Sep 17 00:00:00 2001 From: Claudio Date: Mon, 11 May 2026 21:13:26 +0200 Subject: [PATCH] fix(library/stats): exclude hidden photos from discarded count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Discarded sidebar entry navigates to /photos?is_discarded=true, which already excludes is_hidden=true rows (the cross-cutting hidden-folder filter). The /library/stats discarded_count did not, so the badge could disagree with the actual list — e.g. dtoro saw 1,281 in the badge but only 25 in the view because the hidden Memories/ source root holds 1,256 discarded rows. Aligning the count with the view, like every other sidebar badge already does. --- backend/app/routers/library.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/routers/library.py b/backend/app/routers/library.py index b30668c..baf9ed6 100644 --- a/backend/app/routers/library.py +++ b/backend/app/routers/library.py @@ -85,7 +85,9 @@ async def get_library_stats( discarded_count = ( await db.execute( - select(func.count(Photo.id)).where(owner, Photo.is_discarded.is_(True)) + select(func.count(Photo.id)).where( + owner, Photo.is_hidden.is_(False), Photo.is_discarded.is_(True) + ) ) ).scalar() or 0