feat: filter race time distributions by gender and age group#255
Conversation
…bels Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWYCWpC6wFtk4MH7E4gwDS
Wrapping the <select> in a <label> made the accessible name include the
option text ("Gender All Male Female"). Use htmlFor/id association so the
label is not an ancestor, yielding a clean "Gender" / "Age group" name.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYCWpC6wFtk4MH7E4gwDS
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The CSV corpus (data/*.csv.gz) is generated at build time and absent in the `npm test` CI job, so the previous test read a real race and got empty arrays (green locally only because dev/build had created the gz). Split the pure transform buildRaceSegmentData out of getRaceSegmentData and test it with synthetic finishers — no corpus dependency, and broader coverage (gender ordering, band ordering, -1 sentinel, seconds passthrough). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWYCWpC6wFtk4MH7E4gwDS
Feedback
From a Reddit comment about tritimes.org:
The race page's Time Distributions showed histograms over the entire finisher field, with no way to narrow them to a gender + age-group segment.
What this does
Adds two filter controls above the Time Distributions on
/race/[slug]:M/Fprefix off the age-group code, soM35-39andF35-39collapse into one35-39option)Picking a segment recomputes all four histograms (swim, bike, run, total) instantly in the browser — no reload. A "N of M finishers" line + Reset button appear when a filter is active, and an empty combination shows a tidy empty state. Native
<select>s keep it mobile-friendly and accessible. The default All/All view is server-rendered, so SEO/no-JS output is unchanged.Implementation
app/src/lib/histogram.ts(new, client-safe): extracted the pure histogram helpers (computeRaceHistogram,computeMedian,formatSecondsShort,BIN_SIZES) out ofdata.tsso a client component can use them without pulling the ~190MB data corpus into its bundle (kept clean perimport-graph.test.ts). AddedderiveAgeBandandfilterSegment.getRaceSegmentData(slug)indata.ts: ships a compact per-finisher payload (parallel arrays of splits + gender/age-band indices). ~30–40 KB gzipped worst case (~5K-finisher race); far less typical.RaceDistributions.tsx(new client component): holds the two selections and recomputes histograms in auseMemo, rendering the existingRaceHistogram.Testing
deriveAgeBand,filterSegment,computeRaceHistogramregression, andgetRaceSegmentDatashape (175/175 pass).🤖 Generated with Claude Code
https://claude.ai/code/session_01GWYCWpC6wFtk4MH7E4gwDS