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").
34 lines
2 KiB
SQL
34 lines
2 KiB
SQL
-- =====================================================================
|
|
-- TeeCup — Bingo Bango Bongo (frittstående runder), migrasjon 043.
|
|
-- Fjerde av åtte nye turneringsformater denne runden (se plan/ADR for
|
|
-- full liste). Flatt felt, INGEN sider, poengbasert. Bingo/bango/bongo
|
|
-- er en per-HULL-fakta (hvem vant hver av de tre kategoriene), ikke en
|
|
-- per-spiller/side-fakta -- passer derfor IKKE inn i round_hole sin
|
|
-- eksisterende XOR-form (round_participant_id ELLER round_side_id) --
|
|
-- krever en ny, liten dedikert tabell, én rad per hull for hele runden.
|
|
--
|
|
-- Alle tre kategoriene registreres MANUELT av den som fører score, samme
|
|
-- mønster som "valgt utslag" i scramble/greensome (migrasjon 036) -- INGEN
|
|
-- GPS/live-sporing. Sweep-bonus (dobbelt poeng ved rent sveip) er en
|
|
-- valgfri organisator-innstilling (bekreftet av bruker), IKKE fast på.
|
|
-- Lagvariant bevisst UTENFOR omfang v1 (bekreftet av bruker).
|
|
-- =====================================================================
|
|
\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', 'bbb'));
|
|
|
|
ALTER TABLE round ADD COLUMN bbb_sweep_bonus_enabled boolean NOT NULL DEFAULT false;
|
|
|
|
CREATE TABLE round_bbb_hole (
|
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
round_id uuid NOT NULL REFERENCES round(id) ON DELETE CASCADE,
|
|
hole_number smallint NOT NULL CHECK (hole_number BETWEEN 1 AND 18),
|
|
bingo_participant_id uuid REFERENCES round_participant(id) ON DELETE SET NULL,
|
|
bango_participant_id uuid REFERENCES round_participant(id) ON DELETE SET NULL,
|
|
bongo_participant_id uuid REFERENCES round_participant(id) ON DELETE SET NULL,
|
|
UNIQUE (round_id, hole_number)
|
|
);
|
|
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON round_bbb_hole TO teecup_app;
|