From d7f7bed8c667cd0db0d4e44e3e98f92ae49c3375 Mon Sep 17 00:00:00 2001 From: Samuel Enocsson Date: Fri, 20 Mar 2026 07:37:51 +0100 Subject: [PATCH] fix: use fixed point scale for tour scoring 1st=10, 2nd=8, 3rd=6, 4th=4, 5th=3, 6th=2, 7th=1, rest=0. Ties get same points, next rank skips (1,1,3 pattern). --- src/services/tour-service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/tour-service.js b/src/services/tour-service.js index cfa1bb4..0624771 100644 --- a/src/services/tour-service.js +++ b/src/services/tour-service.js @@ -39,7 +39,7 @@ async function calculateLeaderboard(tourId) { }; } - const numPlayers = players.length; + const pointsByRank = [10, 8, 6, 4, 3, 2, 1]; for (const course of courses) { const courseResults = resultsByCourse[course.tour_course_id] || []; @@ -51,7 +51,7 @@ async function calculateLeaderboard(tourId) { rank = i + 1; } - const points = Math.max(numPlayers - rank + 1, 1); + const points = rank <= pointsByRank.length ? pointsByRank[rank - 1] : 0; const r = courseResults[i]; const relativePar = r.total_strokes - course.par;