fix(library/stats): exclude hidden photos from discarded count
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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user