← 回主控台

三批改動 驗證指南+地基工程報告

2026-07-15 上 main 的全部改動:每一項 UI 在哪裡驗、怎麼驗、預期看到什麼(點卡片打勾,進度存在瀏覽器);最後是本次埋下的地基工程總表。App 已 release 裝機。

零、通知中心與出戰確認(同日早批)

批 1|裁判/線審 v2+結算地基

批 2|治理地基 G1–G7

批 3|營運便利

地基工程報告(這次埋了什麼、為什麼)

判斷標準:UI 隨時能改;資料模型/寫入鏈/權限入口跑了真資料再改=大手術。以下全部「表開對、鏈拆對、入口收攏」,業餘 UI 只露一角。

新資料表(4 張,全上線)

用途關鍵欄位(為未來留的)
arena_tournament_match_officialsper-match 裁判指派(取代純公式輪值)fee_snapshot(結算單一真相)、signed_off_by/at(履歷簽核)、source=invited/temp/handover(稽核)
arena_match_results_logG2 成績確認窗口(積分延遲 commit)commit_after/committed_at(冪等閘)、disputed_*(異議凍結);窗口 0 也寫=審計軌
arena_tournament_staffG1 五大組別職務(權限地基)role enum 六值已備(director/competition/head_referee/venue_ops/admin_pr/medical),專業版直接展開
arena_tournament_feedback賽後問卷(辦賽信譽原料)unique(tournament,profile)一人一筆可改

既有表加欄位

新欄位用途
gym_tournamentsreferees_per_match / lines_per_match / referee_fee_per_match / line_fee_per_match每場需求數+單場報酬
gym_tournamentsresult_confirm_window_minG2 窗口(預設 0=立即,行為不變)
gym_tournamentsregulations / safety / seed_snapshotG4 規程快照、G7 安全保險雨備、G5 種子基準日
gym_tournament_officialsinvite_seq / invited_at / declined_reason遞補順位、N=3 天逾時起算、timeout 標記
gym_tournament_entriesagreed_regulations_at / agreed_regulations_hashG4 報名同意版本化(爭議有憑據)

RPC+排程(server 端)

物件做什麼
arena_notify_officials(RPC)client 發 official_slots_open / official_uncovered(kind 白名單)
arena_notify_tournament(RPC)client 發 tournament_postponed / next_up;同人同場 10 分鐘防重
arena-officials-timeout(cron 每小時 :15)邀請 3 天未回 → 自動棄權(declined_reason=timeout)+通知下一順位
arena-officials-uncovered(cron 台北 06:30)開賽前 2 天內仍有缺額 → 通知主辦幹部(每賽事每天最多一則)

單一入口 Gate(以後改規則只動一處)

Gate收攏了什麼
TournamentStaffGates.can(能力×職務)「我能不能管這場」全部走這裡;主辦館幹部=天然總幹事
_awardForMatch(統一結算閘)四條 record 路的 SLP/館Elo/rubber-band 全收攏;G2 窗口在閘內分流
NotificationGates.isSettled通知「已處理沉底」規則(戰帖定案/金流賽事取消/已讀非待決)
OfficialsV2Gates(9 條)缺額/遞補/逾時/球員兼任/臨時上場/轉交/結算/撞場/per-match 執法者

migrations(全部入庫+已套線上)

supabase/migrations/arena/
  20260715_officials_v2.sql            裁判v2:指派表+results_log+欄位+2 RPC+2 cron
  20260715_governance_foundations.sql  G1 職務表+G4 規程/同意欄位+G7 safety
  20260715_seed_snapshot.sql           G5 種子基準日
  20260715_batch3_ops.sql              問卷表+arena_notify_tournament RPC

cron 不想等的驗證法(測試賽事用)

-- 把某邀請的 invited_at 倒填 4 天前 → 等整點 :15 掃過就會自動棄權+遞補
update gym_tournament_officials set invited_at = now() - interval '4 days'
 where tournament_id = '賽事ID' and status = 'invited';
-- 手動觸發兩支 sweep(不等 cron)
select arena_officials_timeout_sweep();
select arena_officials_uncovered_sweep();