Verification totals: handicap_engine.py unit tests went from 63 → 98 (all passing), plus 400+ scratch-API checks across the eight formats' test scripts, covering both frittstående runder and the appropriate org-scoped system (team or individual) for each. test_isolation.sql stayed 12/12 throughout — migrations 041–050 are purely additive.
A few real things surfaced and were fixed during testing:
Nassau can be blocked by the existing "match already decided" lock (ADR-012) if the overall 18-hole match closes early — documented as a known v1 limitation, not fixed (would mean loosening an established safety guard).
Københavner's points depend on all 3 players at once, breaking the usual "recompute one participant" pattern — handled with a dedicated recompute path.
High-low-high doesn't fit the existing win/loss/halved match cache, so it gets its own dedicated read endpoint (like Nassau) — verified digit-for-digit against your own worked example ("1-1 etter hull 1", "2-1 til lag 2").
Two missing-column crashes (caught in scratch, never reached anything resembling "done").
30 lines
1.8 KiB
SQL
30 lines
1.8 KiB
SQL
-- =====================================================================
|
|
-- TeeCup — Københavner/Copenhagen, migrasjon 042. Andre av åtte nye
|
|
-- turneringsformater denne runden (se plan/ADR for full liste).
|
|
--
|
|
-- Flatt felt, nøyaktig 3 spillere, INGEN sider -- passer ikke ADR-011s
|
|
-- to-lags-modell (bekreftet av ADR-011s eget 2026-07-19-notat). Hører
|
|
-- derfor hjemme i frittstående runder (round.play_format) OG den
|
|
-- individuelle org-turnering-modellen (ADR-037, tournament.scoring_
|
|
-- method) -- ALDRI org-lagturneringer.
|
|
--
|
|
-- 6 poeng per hull fordelt etter relativ rangering (se handicap_engine.py
|
|
-- sin copenhagen_points_for_hole -- kilde: spilletyper-og-spilleformer-
|
|
-- 2023.pdf s.4). Frittstående runder er individuell-ball (som stroke/
|
|
-- stableford), beregnes helt ved lesing fra eksisterende round_hole --
|
|
-- INGEN nye kolonner der. Den individuelle org-modellen cacher derimot
|
|
-- et ferdig utregnet resultat per deltaker (samme mønster som gross_
|
|
-- total/net_total/stableford_points i tournament_round_score, migrasjon
|
|
-- 040) -- én ny kolonne.
|
|
-- =====================================================================
|
|
\set ON_ERROR_STOP on
|
|
|
|
ALTER TABLE round DROP CONSTRAINT round_play_format_check;
|
|
ALTER TABLE round ADD CONSTRAINT round_play_format_check
|
|
CHECK (play_format IN ('stroke', 'match', 'skins', 'fourball', 'foursome', 'greensome', 'scramble_2', 'scramble_4', 'stableford', 'chapman', 'copenhagen'));
|
|
|
|
ALTER TABLE tournament DROP CONSTRAINT tournament_scoring_method_check;
|
|
ALTER TABLE tournament ADD CONSTRAINT tournament_scoring_method_check
|
|
CHECK (scoring_method IS NULL OR scoring_method IN ('stroke_gross', 'stroke_net', 'stableford', 'copenhagen'));
|
|
|
|
ALTER TABLE tournament_round_score ADD COLUMN copenhagen_points smallint;
|