Longest streak of comps in own country
PersonQueue every comp in a country by date; the moment a cuber misses one, the streak resets. Think "perfect-attendance run in your home country".
Limited to in-country comps (competition.country_id = person.country_id), so overseas trips do not break it — captures cubers truly anchored to the local scene.
By the numbers
本国
Scope
Comp country = person's registered country
Top 100
Leaderboard depth
Sorted by streak desc
严格全勤
Break condition
One miss → counter zero
Data source
results deduped on (person_id, competition_id), joined to persons (sub_id = 1) and competitions (with cell_name), filtered by competition.country_id = person.country_id. Country name from countries.name. Ordered by start_date.
sql
SELECT person_link, competition_link, country.name country FROM (SELECT DISTINCT person_id, competition_id FROM results) pc JOIN persons person ON person.wca_id = person_id AND person.sub_id = 1 JOIN competitions competition ON competition.id = competition_id JOIN countries country ON country.id = competition.country_id WHERE competition.country_id = person.country_id ORDER BY competition.start_date
Algorithm / pipeline
1
Bucket by country
Each country gets a time-sorted sequence of comps plus the attendee list per comp.
2
Maintain two tables
currentByPerson = in-progress streaks; longestByPerson = historical best. For each new comp, init new attendees, then check if tracked people showed up.3
Present +1 / absent settle
Present →
current.count += 1, refresh longest. Absent → write current to history, remove from currentByPerson — that's the moment the streak breaks.4
Collect + take 100
Gather every person's longest across countries, sort desc, take top 100. First and break-comp logged.
Caveats & edges
- "Miss" is judged against every comp in that country — even a small 1000 km away one breaks the streak if you skip.
- Primary identity only (
sub_id = 1); after a country change, only the post-change run counts. - Ongoing streaks (never broken) are included —
lastCompetitionleft blank.