Skip to content

Chapter health card on the admin chapter page - #2844

Open
mroderick wants to merge 5 commits into
masterfrom
feature/chapter-health-card
Open

Chapter health card on the admin chapter page#2844
mroderick wants to merge 5 commits into
masterfrom
feature/chapter-health-card

Conversation

@mroderick

@mroderick mroderick commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

I'm trying to think of ways to make it easier for admins and organisers alike to have better insights into the health of chapters. I think that workshop frequency and number of active organisers are some good indicators, so I've tried to capture this in a health card that is displayed at the top of the chapter admin page.


Adds a Chapter Health card to the admin chapter page so admins and chapter organisers can see a chapter's health at a glance, without visiting the separate Chapter Status page.

  • Status badge (active / dormant / inactive) using the same classification rules as the Chapter Status page
  • Previous workshop (days ago) and next workshop (days away), with exact dates on hover
  • Median workshop cadence over the past 180 days
  • Eligible members (subscribed, not banned, TOC accepted) and organiser count
  • Workshop and events timeline: SVG, 180 days past / 90 days future, today marked; workshops as blue circles, single-chapter events as amber squares; same-day events stack with an xN count. Pure SVG plus native tooltips, no JavaScript
image
Design and review notes
  • The card is visible to admins and the chapter's organisers. Chapter show was already organiser-accessible, and the data shown is the chapter's own, so no new access is granted.
  • Single-chapter events only: multi-chapter events list 33-44 chapters each, so they carry no per-chapter signal (production data: 13 events in the last 180 days cover 36 chapters). New Event.single_chapter scope.
  • Classification logic mirrors Admin::ChaptersController#status inline rules; the two implementations coexist by design (status page stays unchanged).
  • Timeline date basis is midnight-aligned so tick labels and markers cannot drift at DST boundaries.
  • Reviews applied: layered-rails (scope extraction, view arithmetic moved to the value object, spec coverage restored), ponytail-review (dead code, inlined single-caller module), ce-code-review (test gap on the new scope).
  • Residual cosmetic edge: more than three same-day events stack only three markers; the xN label still shows the true count.

Events linked to exactly one chapter are a per-chapter signal, unlike
multi-chapter events which list dozens of chapters. The scope filters
for them so chapter views can use events as a health signal.
Admin::Dashboard::ChapterHealth.row returns one health row for a
chapter: status bucket (active/dormant/inactive, mirroring the Chapter
Status page classification), workshop recency and countdown, median
workshop cadence over the past 180 days, eligible member counts, and
organiser count.
SVG timeline for one chapter: 180 days past, 90 days future, today
marked at the 2/3 point. Workshops render as blue circles (hollow when
planned), single-chapter events as amber squares, same-day workshops
stack with an xN count (capped at three markers so they stay in bounds),
tooltips show ISO8601 dates. The legend is drawn inside the SVG so it
scales with the markers. No JavaScript.
Adds a Chapter Health section to /admin/chapters/:id, visible to admins
and the chapter's organisers. Admin::Dashboard::HealthCardComponent
renders the stat tiles (status badge, previous/next workshop, median
cadence, eligible members, organiser count) from a ChapterHealth::Row
and yields the workshop and events timeline into the card body. The
card sits above Upcoming Workshops in the right column.
@mroderick
mroderick force-pushed the feature/chapter-health-card branch from 51bddc1 to 7463696 Compare September 5, 2026 14:22
@mroderick
mroderick marked this pull request as ready for review September 5, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant