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").
17 lines
1.1 KiB
SQL
17 lines
1.1 KiB
SQL
-- =====================================================================
|
|
-- TeeCup — Money Ball/Lone Ranger (org-lagturnering), migrasjon 049.
|
|
-- Samme begrunnelse som 048 -- se den migrasjonens header. HER brukes
|
|
-- eksisterende to-siders match-struktur (to Money Ball-lag à 4 møtes).
|
|
-- lineup_order plasseres på match_participant (ikke team_roster) siden
|
|
-- rekkefølgen er meningsfull PER MATCH, samme prinsipp som team_side
|
|
-- selv er match-scopet, ikke roster-scopet.
|
|
-- =====================================================================
|
|
\set ON_ERROR_STOP on
|
|
|
|
ALTER TABLE session DROP CONSTRAINT session_format_check;
|
|
ALTER TABLE session ADD CONSTRAINT session_format_check
|
|
CHECK (format IN ('singles', 'fourball', 'foursome', 'greensome', 'scramble_2', 'scramble_4', 'chapman', 'shamble', 'money_ball'));
|
|
|
|
ALTER TABLE match_participant ADD COLUMN lineup_order smallint CHECK (lineup_order IS NULL OR lineup_order BETWEEN 0 AND 3);
|
|
CREATE UNIQUE INDEX match_participant_lineup_order_unique
|
|
ON match_participant (match_id, team_side, lineup_order) WHERE lineup_order IS NOT NULL;
|