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 9eb94fa14c779251dfb0bd471316ce476b8dc428
parent 72eb49a426ea1acefad7950e12df7a5bf7f6b2a4
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Thu, 26 Sep 2024 23:48:25 +0200

fix(leaderboard): set n/a for if no scores

Diffstat:
Msrc/frontend/Leaderboard.jsx | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/frontend/Leaderboard.jsx b/src/frontend/Leaderboard.jsx @@ -104,9 +104,9 @@ async function getScoreSummary(heatIds) { console.error(error) } - // find best/worst heat - i.bestHeat = Math.max(...i.heats.map(h => h.summary)) - i.worstHeat = Math.min(...i.heats.map(h => h.summary)) + // find best/worst heat, use 'n/a' if no score yet + i.bestHeat = i.heats.length > 0 ? Math.max(...i.heats.map(h => h.summary)) : 'n/a' + i.worstHeat = i.heats.length > 0 ? Math.min(...i.heats.map(h => h.summary)) : 'n/a' // sum up all totals across heats i.sum = i.heats.map(h => h.summary).reduce((a, b) => a + b, 0).toFixed(1)