Add a Listed flag: published records reachable only by their link
is_listed (migration 027) sits beside is_published on organizations, events, people, teams and awards. Unticked, the record's own page still works, but the site's lists leave it out: the list routes, a region's chapters, an organization's events, teams and awards, the QR page's directory, and the front page's counts and countdown. Places where someone attached it by hand (rosters, hosts, billed people, recipients, timeline, a pinned countdown) still show it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3c02eb8971
commit
cd393e4ab2
7 changed files with 120 additions and 38 deletions
|
|
@ -15,15 +15,17 @@
|
|||
|
||||
── Stats ──
|
||||
A stat's source picks a query from STAT_QUERIES. Each counts
|
||||
exactly what the matching public page shows: published rows, and
|
||||
for awards only public citations to published people. A count
|
||||
exactly what the matching public page shows: published, listed
|
||||
rows, and for awards only public citations to published people
|
||||
(an award's page names its recipients whether they're listed or
|
||||
not, so the count does too). A count
|
||||
that disagreed with the page it summarises would be worse than
|
||||
none. 'manual' and 'years_since' read the row's own value.
|
||||
|
||||
── Countdown ──
|
||||
The pinned event if it is still published and not over;
|
||||
otherwise the next published, non-cancelled event that hasn't
|
||||
ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
|
||||
The pinned event if it is still published and not over, listed
|
||||
or not; otherwise the next published, listed, non-cancelled
|
||||
event that hasn't ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
|
||||
so a running series with a start date in the past still counts.
|
||||
The client works out the next meeting of a series from `series`.
|
||||
|
||||
|
|
@ -46,15 +48,15 @@ const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
|
|||
const PAGE_ID = "home";
|
||||
|
||||
const STAT_QUERIES = {
|
||||
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1`,
|
||||
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' AND is_published = 1`,
|
||||
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1`,
|
||||
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
|
||||
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' AND is_published = 1 AND is_listed = 1`,
|
||||
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1 AND is_listed = 1`,
|
||||
events_held: `SELECT COUNT(*) AS n FROM v_events
|
||||
WHERE is_published = 1 AND effective_status = 'past'`,
|
||||
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,
|
||||
retreats_held: `SELECT COUNT(*) AS n FROM v_events
|
||||
WHERE is_published = 1 AND effective_status = 'past'
|
||||
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'
|
||||
AND event_type = 'retreat'`,
|
||||
people: `SELECT COUNT(*) AS n FROM people WHERE is_published = 1`,
|
||||
people: `SELECT COUNT(*) AS n FROM people WHERE is_published = 1 AND is_listed = 1`,
|
||||
awards_given: `SELECT COUNT(*) AS n
|
||||
FROM person_awards pa
|
||||
JOIN people p ON p.id = pa.person_id AND p.is_published = 1
|
||||
|
|
@ -166,7 +168,7 @@ home.get("/front-page", (c) => {
|
|||
db
|
||||
.prepare(
|
||||
`SELECT * FROM v_events
|
||||
WHERE ${notOver} ${filters.join(" ")}
|
||||
WHERE ${notOver} AND is_listed = 1 ${filters.join(" ")}
|
||||
ORDER BY starts_on, title
|
||||
LIMIT 1`,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue