Add straight up / net handicap option for skins games

When creating a skins game, players can now choose between straight up
(gross scores) or net scoring (strokes subtracted per hole based on
playing handicap and stroke index). Net mode is stored on the game and
applied in both the live scorecard and the summary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Rolf
2026-03-23 21:16:10 +01:00
parent 6317422316
commit 2c0717948a
5 changed files with 44 additions and 10 deletions
+7 -2
View File
@@ -280,6 +280,7 @@ const GAME_FORMAT = "{{ game.format }}";
const SKINS_CARRYOVER = {{ carryover | tojson }};
const SKIN_VALUE = {{ skin_value | tojson }};
const SKIN_DOUBLE_BACK9 = {{ skin_double_back9 | tojson }};
const SKINS_NET = {{ skins_net | tojson }};
const HOLE_PARS = {{ hole_pars | tojson }};
const HOLE_SIS = {{ hole_stroke_indices | tojson }};
const STROKES_PER_HOLE = {{ strokes_per_hole | tojson }};
@@ -494,8 +495,12 @@ function gameApp() {
if (this.isSkipped(hole)) continue;
const holeScores = this.scores[hole] || {};
const scored = PLAYERS_DATA
.map(p => ({ id: p.id, strokes: holeScores[p.id]?.strokes || 0 }))
.filter(x => x.strokes > 0);
.map(p => {
const gross = holeScores[p.id]?.strokes || 0;
const net = SKINS_NET ? gross - ((STROKES_PER_HOLE[p.id] || {})[hole] || 0) : gross;
return { id: p.id, strokes: net, gross };
})
.filter(x => x.gross > 0);
if (scored.length === 0) continue;
pot += 1;
if (SKIN_VALUE) moneyPot += SKIN_VALUE * (SKIN_DOUBLE_BACK9 && hole >= 10 ? 2 : 1);