Back to WCA Statistics

Longest streak of comps with a PR

Person

Walk a cuber's comps in order — as long as a comp produces at least one PR (any event's single or average), the streak ticks up; one comp without a PR resets it.

A "sustained improvement" metric — you don't need to be top in any event, but you need to extract a fresh PR from somewhere at every comp.

By the numbers

single + avg
PR types
Either resets +1
Top 100
Leaderboard depth
Sorted by streak desc
≤ 历史最佳
PR check
`val <= pb` — ties count

Data source

Full results joined to persons / competitions / round_types, sorted by start_date, round_type.rank. Each row has event_id, best (single), average. Any round breaking the per-event PB counts the whole comp as "had a PR".

sql
SELECT person_link, competition_link,
       event_id, best single, average
FROM results
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.rank

Algorithm / pipeline

1
Bucket by person → comp
Outer bucket: person_link. Inner bucket: gather all event-rounds at one comp into a single "comp snapshot".
2
Track per-event PB
pbsByEvent holds single-PB and average-PB per event (both start at Infinity); iterate every result in the snapshot.
3
Decide "comp had a PR"
Any event × type where val > 0 && val <= pb fires the refresh and flips competitionWithPb. <= means ties count.
4
Advance / reset
PR found → count += 1, refresh longest; no PR → close current, open fresh on next comp.

Caveats & edges

Related stats & links