Longest streak of podiums
PersonSingle-event lens: from some comp onward, every final placing top 3 ticks +1; a final outside top 3 ends it. Counter granularity is (person, event) — one cuber can sustain parallel streaks across 3x3 and Square-1.
"Ignore comps that didn't hold the event" is the key relaxation — a comp without Square-1 doesn't kill a Square-1 streak.
By the numbers
决赛 + 前 3
Podium rule
`is_final = 1 AND pos ≤ 3`
(人 × 项目)
Streak key
Same person, different events, separate counters
best > 0
Must complete
All-DNF final doesn't qualify
Top 100
Leaderboard depth
Sorted by streak desc
Data source
results joined to events / persons / competitions / round_types. Each row has round_type.final (is-final flag), pos (place), best (single). Ordered by start_date, round_type.rank — earlier rounds precede finals within a comp.
sql
SELECT event.name event_name, person_link, competition_link,
round_type.final is_final, pos place, best single
FROM results
JOIN events event ON event.id = event_id
JOIN persons person ON person.wca_id = person_id AND person.sub_id = 1
JOIN competitions competition ON competition.id = competition_id
JOIN round_types round_type ON round_type.id = round_type_id
ORDER BY competition.start_date, round_type.rankAlgorithm / pipeline
1
Group by (person, comp, event)
Outer by person; inner by
(comp, event) key — multiple rows in a key = multiple rounds.2
Take the last round
groupRows[groupRows.length - 1] — SQL already orders by round_type.rank, so the last row is the final (if is_final = 1).3
Podium check / advance
is_final && place ≤ 3 && single > 0 → current.count += 1; otherwise commit current, remove the event from currentByEvent — fresh streak next time.4
Collect + take 100
Flatten every (person, event) streak (including ongoing), sort desc by count, take 100.
Caveats & edges
- Comps that don't hold the event are skipped automatically — no row, loop never touches
currentByEvent.event. - All-DNF finals (
single = -1or0) don't count even if place ≤ 3 —single > 0gate. - Finals only — winning a semi but bombing the final = "no podium" for that comp.