Configure: Western Cape Schools Cycling Annual Leaderboard

This procedure assumes the Leaderboard Model — it is the operator’s "set it up" companion to that design. Read the model first if you are unsure what a LeaderboardType, levelFilter, or PointsCalculator is.

1. Outcome

A configured set of leaderboards for the Western Cape Schools Cycling (WCSC) season, ready to be populated from imported race results:

  • School and Top Schools boards ranking schools by aggregate points, split by PS (Primary School) and HS (High School) level and by gender.

  • An All Stars board combining the male and female school totals.

  • An Individual Rider board ranking riders by season-wide points.

All boards score with the default SASchoolCyclingSeriesPointsCalculator (1→250, 2→200, … tapering to 1 for 68+) and group schools by EventParticipant.custom3 (the School CustomList).

2. Cadence

Once per season, when the WCSC series and its events have been created. Re-run only when the board structure changes (new level/gender split, new category). Per-event result import is a separate, recurring task — see Import Operations Guide.

3. Prerequisites

  1. The WCSC Series exists for the season, with its series-level EventCategory rows in place (the categories riders are classified into).

  2. The School CustomList exists on the organisation and is mapped to EventParticipant.custom3 on the series' events, so imported EPs carry their school.

  3. The PS and HS CustomListValue`s exist (the level classification used as `levelFilter).

  4. You have the target environment’s series id and series-category ids to hand (query them in the target DB — they are environment-specific, not fixed).

4. Steps

4.1. 1. Decide the board matrix

WCSC boards are the product of level (PS, HS) × gender (Male, Female) × type. A typical season is:

Board type Filters Notes

Top Schools — PS Boys

TOP_SCHOOLS

levelFilter=PS, gender=MALE

topCount = best N riders per school (e.g. 5)

Top Schools — PS Girls

TOP_SCHOOLS

levelFilter=PS, gender=FEMALE

topCount e.g. 3

Top Schools — HS Boys

TOP_SCHOOLS

levelFilter=HS, gender=MALE

Top Schools — HS Girls

TOP_SCHOOLS

levelFilter=HS, gender=FEMALE

All Stars — PS

ALL_STARS

levelFilter=PS, gender=NULL

Combines PS Boys + PS Girls school totals

All Stars — HS

ALL_STARS

levelFilter=HS, gender=NULL

Individual Rider

INDIVIDUAL_RIDER

optional levelFilter

Season-wide per-Person points

A plain School (SCHOOL) board — every result counted, no topCount — can be added where a total-participation ranking is wanted alongside Top Schools.

4.2. 2. Create the Leaderboard rows

For each board, create a Leaderboard with:

  • series = the WCSC series.

  • type, gender, levelFilter, topCount, resultLimit per the matrix.

  • groupByList = the School CustomList.

  • pointsCalculatorClass = leave blank to use the default SASchoolCyclingSeriesPointsCalculator, or set it explicitly for clarity.

  • active = true.

-- Illustrative; substitute the real series id, levelFilter CustomListValue id,
-- and School CustomList id for the target environment.
INSERT INTO leaderboard
  (name, type, gender, top_count, result_limit, active,
   points_calculator_class, series_id, level_filter_id, group_by_list_id)
VALUES
  ('Top Schools — HS Boys', 'T', 'M', 5, 50, 1,
   'SASchoolCyclingSeriesPointsCalculator', :seriesId, :hsValueId, :schoolListId);

4.3. 3. Wire each board to its series categories

Add a LeaderboardCategory row for every series category that feeds the board (this replaces the old hardcoded series_category_id IN (…) lists). Set pointsMultiplier only where a category is weighted differently.

INSERT INTO leaderboard_category (leaderboard_id, series_category_id, points_multiplier)
VALUES (:leaderboardId, :seriesCategoryId, NULL);

4.4. 4. Populate the standings

Until Leaderboard Sync lands, standings are aggregated manually from RaceResult.points. Ensure each event’s results have been imported with correct points (default calculator), then run the season aggregation that groups by school (custom3), applies the level/gender filters, and — for Top Schools — keeps only the best topCount per school.

5. Verification

  • Each intended board exists with the right type / gender / levelFilter / topCount.

  • Every board has at least one LeaderboardCategory row; the set matches the season’s categories for that level.

  • Spot-check one school’s total against the underlying RaceResult.points for its riders in the relevant categories.

  • PS and HS boards do not bleed into each other (a rider’s custom1 level matches the board’s levelFilter).

6. Recovery

  • Wrong points on a board → the scoring happened at import; re-import the affected event’s results (default calculator) per Import Operations Guide, then re-aggregate.

  • Missing school → check the EP’s custom3 (school) is set; schools with no custom3 are excluded by design.

  • Board double-counts or omits a category → audit the board’s LeaderboardCategory rows.

7. References