From c8d9cdbb3a941c9774385c9e4a0925a4dce9f527 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sat, 28 Sep 2024 13:10:56 -0700 Subject: [PATCH] Demographics page: count only 'gallery' photos The photo stats were counting ALL public photos of certified members, whether featured on the Site Gallery or not. Update the query to filter for Site Gallery photos instead. --- pkg/models/demographic/queries.go | 1 + web/templates/demographics.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/models/demographic/queries.go b/pkg/models/demographic/queries.go index f2d85ef..bd1e470 100644 --- a/pkg/models/demographic/queries.go +++ b/pkg/models/demographic/queries.go @@ -278,6 +278,7 @@ func PhotoStatistics() Photo { photos JOIN users ON (photos.user_id = users.id) WHERE photos.visibility = 'public' + AND photos.gallery IS TRUE AND users.certified IS TRUE AND users.status = 'active' GROUP BY photos.explicit diff --git a/web/templates/demographics.html b/web/templates/demographics.html index be51138..e1a8097 100644 --- a/web/templates/demographics.html +++ b/web/templates/demographics.html @@ -210,7 +210,7 @@ {{range .Demographic.People.IterOrientations}}
- {{or .Label "(No answer)"}} + {{or .Label "No answer"}} ({{FormatNumberCommas .Count}})