Individual Rider and All Stars Standings

1. Overview

Leaderboard Materialisation specifies how a standing is persisted, ranked and published, for the group standings SCHOOL and TOP_SCHOOLS. This page specifies the stored standing for the other two leaderboard types, ALL_STARS and INDIVIDUAL_RIDER, within the same model: two tiers, a cascade from result change to season standing, one active standing per subject, and the ranking, versioning and failure rules of the sibling page. Where this page is silent, the sibling page applies.

Type Standing

ALL_STARS

A school standing. The Top Schools rule with no gender filter, so the type materialises exactly as TOP_SCHOOLS does. See All Stars.

INDIVIDUAL_RIDER

A rider standing per category, at both tiers, with the person as the row’s subject. The single-active-standing invariant is generalised to include the category. See Individual Rider.

2. Requirements

2.1. Common to both types

Id Requirement

CM-1

Every standing is stored as a ResultSet linked to its leaderboard, at both tiers, so that the standings of a board can be enumerated and displayed without recalculation.

CM-2

A standing carries position and seq on every row and is versioned. When a recalculation of it fails, a FAILED draft is recorded beside it under the sibling page’s rules; the standing itself is untouched.

CM-3

A change to rider results at an event recalculates the per-event standing for that event and then the season standing, through the sibling page’s cascade.

2.2. All Stars

Id Requirement

AS-1

An All Stars board ranks schools by the sum of each school’s best top_count rider results of either gender at the event, within the board’s linked categories and level filter.

AS-2

Excluded grouping values and result_limit apply as on a Top Schools board.

AS-3

The season standing is the sum of the board’s own per-event standings.

2.3. Individual Rider

Id Requirement

IR-1

An individual board is presented per category: a per-event standing lists the riders of one category at one event, and a season standing lists the riders of one series category.

IR-2

A per-event standing lists every rider with a result in the category, in race order, with points, status and school.

IR-3

A season standing ranks riders by the sum of their points across the season’s events in that series category, and lists riders who have scored.

IR-4

A rider’s school is the school on the rider’s entry, and a season standing shows the school the rider raced for most recently.

IR-5

Riders level on points share a position.

IR-6

A board may count only a rider’s best N events, where N is configured; by default every event counts.

IR-7

The category grouping is fixed: it is not a display preference.

3. All Stars

3.1. Aggregation rule

The Top Schools rule of the sibling page with the gender predicate removed:

  1. Select candidate results: the board’s linked series categories and its level filter, with no gender predicate.

  2. Group by the slot carrying group_by_list; within each school take the best top_count results by points, of either gender.

  3. Sum those to the school total.

  4. Remove excluded groups.

  5. Rank, and cut to result_limit, extended through a tie at the boundary.

The board’s configuration expresses the whole rule: gender = NULL, a top_count, a level filter, category links and a grouping list.

3.2. Materialisation

Element Design

Calculator

The school calculator serves the type, selected through a delegate as TOP_SCHOOLS is. The absence of a gender on the board is what removes the predicate; the calculator has no type-specific branch.

Tier 1

One standing per board and event. Rows are keyed by the school in the grouping slot, with position by competition ranking and seq by (points DESC, school id ASC).

Tier 2

The sibling page’s cumulative roll-up: a SUM over the board’s own per-event standings, with result_limit applied again at publication. The board has no dependency on any other board.

Empty input

An event with rider results but no candidate for the board materialises an empty standing.

Failure

The sibling page’s FAILED draft applies unchanged: one inactive draft beside each standing the attempt would have rewritten, the standing itself untouched.

4. Individual Rider

4.1. The two tiers, per category

Tier One ResultSet per ResultSet carries Contents

Per-event

board, event and event category

event_id, event_category_id = the event category

each rider’s result in that category at that event

Cumulative

board and series category

event_id = NULL, event_category_id = the series category

each rider’s season total in that series category

The subject of a season standing is the pair of person and series category. A rider who scores in more than one series category during a season appears in each, with that category’s results only.

Group standings carry event_category_id = NULL on both tiers.

4.2. The single-active-standing invariant, generalised

Exactly one active standing exists:

  • at tier 1, per board, event and category;

  • at tier 2, per board and series category.

For a group board the category is NULL and the invariant reads as on the sibling page. The lookups that find, adopt or create the current standing, and the checks that refuse to proceed when more than one is active, include the category. The cumulative calculation of an individual board sums only the tier-1 standings whose event category maps to its series category.

4.3. Tier 1 — the rider’s result at the event

One row per rider result in the category.

Field Design

person_id

The subject, taken from the entry. A result whose entry has no person is not a row.

event_participant_id

NULL. Standing rows are participant-less; the row is the standing’s view of the result.

position

The race position. This is the one exception to the sibling page’s rule that position is competition ranking on points: on a scoring scale with a flat tail, ranking on points would give every rider past the last scored place one shared position. Ranking on points is tier 2’s.

points, status

Copied from the result. Non-finishers are rows, with their status and zero points.

grouping slot

The rider’s school from the entry, in the slot carrying the board’s group_by_list. An attribute of the row, not part of its key.

seq

(points DESC, position ASC, person id ASC). The upsert key: unique, deterministic, no sporting meaning.

4.4. Tier 2 — the season standing in the series category

A SUM over the active tier-1 standings whose event category maps to the series category, grouped by person.

Field Design

person_id

The subject and the row’s identity within the standing.

points

The sum of the rider’s tier-1 points in the category. A rider whose sum is zero is not a row.

position

Competition ranking on points: tied riders share a position and the next position skips.

grouping slot

The school on the rider’s most recent tier-1 row, by event start time. An attribute, not part of the key: a rider who changed school during the season has one season row, under the school raced for last.

seq

(points DESC, person id ASC).

result_limit

Applied at publication, extended through a tie at the boundary. NULL publishes every rider.

top_count

Best N per-event standings per rider, applied only when set. It has no meaning at tier 1, where a rider has one result per category per event, so it is the one rule the cumulative tier applies that is not a pure roll-up.

4.5. Event scope

An individual board has a tier-1 standing at every event of its series that has rider results in its linked categories. The board has no event set of its own; the events it covers are those its categories are raced at.

4.6. Empty input and failure

  • An event and category with no rider results has no tier-1 standing. A category whose results all score zero has a standing of non-finishers.

  • A series category with no tier-1 rows has an empty tier-2 standing.

  • A failed recalculation records a FAILED draft beside every tier-1 standing the attempt resolved and beside every tier-2 standing of the board, through the sibling page’s mechanism applied per category. The targets keep the per-category identities defined on this page; the published standings are untouched.

  • A draft in a category the recalculation no longer produces, at either tier, is promoted empty, as a standing there is emptied.

  • An attempt can fail at an event before it has resolved the event’s categories, for instance when the board’s school list is not one of the event’s custom lists. Such an event, with no standing or draft there to give it a category, is itself the target: its draft has no category. The sweep retries the event by it, and it holds the roll-up as any event draft does. The event’s next successful recalculation discards it, since each category then has its own standing or draft. The season’s targets are the board’s linked series categories, recorded before any event is calculated.

5. The leaderboard type

With ALL_STARS served by the school calculator, the type does not select an algorithm among the three school-based types. SCHOOL against TOP_SCHOOLS is whether top_count is set, and TOP_SCHOOLS against ALL_STARS is whether gender is set. The type distinguishes boards for display. INDIVIDUAL_RIDER alone selects a different calculation.

6. Schema

Both types use columns the schema already has.

Column Use

result_set.leaderboard_id

Links every standing of both types to its board.

result_set.event_category_id

The event category of a tier-1 individual standing; the series category of a tier-2 one. NULL on group standings.

race_result.person_id

The subject of an individual standing row.