Add complete CS2 event reset to clear orphaned results/QP #102
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/cs2-complete-event-reset"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The CS2 Major EV simulation showed no change after the last commit's bracket-conditioning work, for IEM Cologne 2026. Root cause:
playoff_matches) seeds QF1 with "Team Spirit", but the stage assignments (cs2_major_stage_results) list the different participant "Spirit Academy" as the advancing team.realBracketgate incs-major-simulator.tsis all-or-nothing: one out-of-field QF participant makes it reject the entire bracket (including the 3 valid completed QFs), so the stage falls back to Elo seeding → EV unchanged.event_resultsrow (33 rows for 32 teams) plus a cached QP total.The existing "Reset all" button only cleared
cs2_major_stage_results, so re-entering with the correct team couldn't remove the phantom result or its cached QP.Change
resetCs2Event(new) clears stage assignments and the event'sevent_results, then recomputes the affected participants' cached QP totals — all inside one transaction so a mid-operation failure can't leave the event torn (assignments gone but stale QP surviving in standings).playoff_matches) so re-entry realigns the stage data to it.Recovery (operational, after merge)
Reset the event → re-enter stage assignments using "Team Spirit" → re-process the bracket to restore real placements → re-run the EV sim (bracket now drives it).
Tests
resetCs2Event: clears both tables inside the transaction and recomputes each distinct participant once; no-op recompute when there are no results.🤖 Generated with Claude Code