feat(admin): organisation-wide monthly stats page for admins - #2866
Open
mroderick wants to merge 3 commits into
Open
feat(admin): organisation-wide monthly stats page for admins#2866mroderick wants to merge 3 commits into
mroderick wants to merge 3 commits into
Conversation
mroderick
force-pushed
the
feat/admin-stats-page
branch
from
September 10, 2026 17:21
c2c164c to
bcd08ab
Compare
Admin::Stats::Range resolves 3/6/12-month presets anchored at the last complete month and inclusive custom start/end month ranges: explicit months take precedence over a preset, future end months clamp to the last complete month, reversed ranges and spans beyond 240 months return an explicit invalid state (the page shows an inline error, the CSV export falls back to the default range), and absent or malformed input falls back to the default 3 complete months.
Admin::Stats::Monthly computes organisation-wide monthly rows for any resolved range entirely in Postgres: attendance (check-ins and RSVPs as independent bases per role), sign-ups by current group membership with distinct-member totals via a single left-join query, and workshop counts — each grouped by calendar month in the app time zone, so cost is independent of row counts. Totals are range totals only.
Admin::StatsController serves the HTML page and CSV export from one action, enforcing the global-admin check itself on top of the admin area's admins-plus-organisers default. The page renders one captioned table per metric group with right-aligned, thousands-separated cells, preset and custom-month GET forms with inline validation, and a Download CSV link built from the resolved range so the export mirrors the displayed table; the admin portal gains a Stats button beside Chapter Status.
mroderick
force-pushed
the
feat/admin-stats-page
branch
from
September 10, 2026 17:32
bcd08ab to
53342a7
Compare
Contributor
|
This is very very exciting 👀 |
mroderick
marked this pull request as ready for review
September 10, 2026 18:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Super admins can now pull codebar-wide monthly numbers for any month range on an admin page and export the same figures as CSV. The page exists for grant reporting, where the current stats surface can only break numbers down per year.
Fixes #2860
Review notes
Admin::StatsController#index: the page shows an inline error and keeps the last valid range; the CSV endpoint instead falls back to the default range.Admin::Stats::Monthly: a member in both a Students and a Coaches group appears in both role rows but once in the total, so role rows may sum above it.Background and scope
Post-deploy monitoring
/admin/statsresponse times in Scout APM; the page runs three grouped aggregate queries per render with no caching.Admin::StatsorCookieOverfloware the rollback signal; revert the branch.