myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit ddf659b060a83def4099ec694d02ab5af2a6f70d
parent 294fcfcfe911411940d8cbd5c6211df9dfce0f97
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sun,  6 Oct 2024 22:09:23 +0200

feat: fix rank by best

Comparator function should always return an integer value

Diffstat:
Msrc/frontend/utils.js | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/frontend/utils.js b/src/frontend/utils.js @@ -71,12 +71,10 @@ export const rankByHeat = function(rankingComp) { switch(r.value) { case 'start': // rank by start number - return b.nr < a.nr + return a.nr - b.nr case 'best': - if (b.bestHeat - a.bestHeat !== 0) { - // rank by best heat first - return b.bestHeat - a.bestHeat - } + // rank by best heat first + return b.bestHeat - a.bestHeat // rank by least worst heat for identical best heats return b.worstHeat - a.worstHeat case 'worst':