Import gender tees + front/back split ratings; front/back/9 hole selection
Course import now fetches both male and female tees, each with their own per-tee stroke indices extracted from the holes array. Front and back 9 slope/rating are stored per tee for more accurate WHS handicap calculation. New game creation replaces the 9/18 radio with a course-aware selector: 18-hole courses offer 18 holes, Front 9, or Back 9; 9-hole courses auto- select. start_hole is stored on the game and used throughout scoring, handicap calculation, and scorecard rendering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<button @click="view === 'score' ? prevHole() : cardPrev()" class="icon-btn"
|
||||
:disabled="view === 'score' ? currentHole <= 1 : cardView === 'strokes'">‹</button>
|
||||
<div style="text-align:center; flex:1;">
|
||||
<div class="hole-label" x-text="view === 'score' ? 'Hole ' + currentHole + ' / {{ game.holes_count }}' : (cardView === 'strokes' ? 'Strokes' : cardView === 'points' ? 'Points' : 'Skins')"></div>
|
||||
<div class="hole-label" x-text="view === 'score' ? 'Hole ' + currentHole + ' / ' + (START_HOLE + GAME_HOLES - 1) : (cardView === 'strokes' ? 'Strokes' : cardView === 'points' ? 'Points' : 'Skins')"></div>
|
||||
<div style="font-size:0.72rem; color:var(--text-muted); margin-top:0.1rem;">
|
||||
<template x-if="view === 'score'">
|
||||
<span x-text="(HOLE_PARS[currentHole] ? 'Par ' + HOLE_PARS[currentHole] : '') + (HOLE_SIS[currentHole] ? ' · SI ' + HOLE_SIS[currentHole] : '')"></span>
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<button @click="view === 'score' ? nextHole() : cardNext()" class="icon-btn"
|
||||
:disabled="view === 'score' ? currentHole >= {{ game.holes_count }} : cardView === (GAME_FORMAT === 'skins' || SIDE_SKINS_ENABLED ? 'skins' : 'points')">›</button>
|
||||
:disabled="view === 'score' ? currentHole >= START_HOLE + GAME_HOLES - 1 : cardView === (GAME_FORMAT === 'skins' || SIDE_SKINS_ENABLED ? 'skins' : 'points')">›</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -282,6 +282,7 @@ const SKIN_VALUE = {{ skin_value | tojson }};
|
||||
const SKIN_DOUBLE_BACK9 = {{ skin_double_back9 | tojson }};
|
||||
const SKINS_NET = {{ skins_net | tojson }};
|
||||
const SIDE_SKINS_ENABLED = {{ side_skins_enabled | tojson }};
|
||||
const START_HOLE = {{ start_hole | tojson }};
|
||||
const HOLE_PARS = {{ hole_pars | tojson }};
|
||||
const HOLE_SIS = {{ hole_stroke_indices | tojson }};
|
||||
const STROKES_PER_HOLE = {{ strokes_per_hole | tojson }};
|
||||
@@ -296,7 +297,7 @@ function gameApp() {
|
||||
return {
|
||||
view: 'score',
|
||||
cardView: 'strokes',
|
||||
currentHole: 1,
|
||||
currentHole: START_HOLE,
|
||||
players: [],
|
||||
scores: {}, // { hole: { uid: {strokes,bingo,bango,bongo} } }
|
||||
totals: {},
|
||||
@@ -447,7 +448,7 @@ function gameApp() {
|
||||
},
|
||||
|
||||
allHolesDone() {
|
||||
for (let h = 1; h <= GAME_HOLES; h++) {
|
||||
for (let h = START_HOLE; h <= START_HOLE + GAME_HOLES - 1; h++) {
|
||||
if (this.isSkipped(h)) continue;
|
||||
const holeScores = this.scores[h];
|
||||
if (!holeScores || Object.keys(holeScores).length === 0) return false;
|
||||
@@ -455,8 +456,8 @@ function gameApp() {
|
||||
return true;
|
||||
},
|
||||
|
||||
prevHole() { if (this.currentHole > 1) { this.saveHole(this.currentHole); this.currentHole--; } },
|
||||
nextHole() { if (this.currentHole < GAME_HOLES) { this.saveHole(this.currentHole); this.currentHole++; } },
|
||||
prevHole() { if (this.currentHole > START_HOLE) { this.saveHole(this.currentHole); this.currentHole--; } },
|
||||
nextHole() { if (this.currentHole < START_HOLE + GAME_HOLES - 1) { this.saveHole(this.currentHole); this.currentHole++; } },
|
||||
|
||||
cardTabs() {
|
||||
if (GAME_FORMAT === 'skins') return ['strokes', 'skins'];
|
||||
@@ -508,7 +509,7 @@ function gameApp() {
|
||||
const holes = {};
|
||||
let pot = 0;
|
||||
let moneyPot = 0;
|
||||
for (let hole = 1; hole <= GAME_HOLES; hole++) {
|
||||
for (let hole = START_HOLE; hole <= START_HOLE + GAME_HOLES - 1; hole++) {
|
||||
if (this.isSkipped(hole)) continue;
|
||||
const holeScores = this.scores[hole] || {};
|
||||
const scored = PLAYERS_DATA
|
||||
|
||||
Reference in New Issue
Block a user