From e562122ab47c72b0cd1fab49f9230d54f2486c73 Mon Sep 17 00:00:00 2001 From: Thies Mueller Date: Wed, 26 Aug 2026 23:35:49 +0200 Subject: [PATCH] dynamic race tracks --- app.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app.js b/app.js index ba47a43..70b92ee 100644 --- a/app.js +++ b/app.js @@ -149,17 +149,17 @@ function renderRennplan() {
- - Bahn 1 · ${race.bahn1} - - - - Bahn 2 · ${race.bahn2} - - - - Bahn 3 · ${race.bahn3} - + ${[ + ["Bahn 1", race.bahn1], + ["Bahn 2", race.bahn2], + ["Bahn 3", race.bahn3] + ] + .filter(([, value]) => value !== undefined && value !== null && value !== "") + .map(([label, value]) => ` + + ${label} · ${value} + + `).join("")}
@@ -178,7 +178,7 @@ function renderResults() { races.forEach(([_, race]) => { - const lane = (key, data, winner) => { + const lane = (key, data) => { const isWinner = race.winner === key; return ` @@ -205,6 +205,8 @@ function renderResults() { `; }; + const lanes = ["bahn1", "bahn2", "bahn3"] + .filter(key => race[key] !== undefined && race[key] !== null); container.innerHTML += `
@@ -226,9 +228,7 @@ function renderResults() {
- ${lane("bahn1", race.bahn1)} - ${lane("bahn2", race.bahn2)} - ${lane("bahn3", race.bahn3)} + ${lanes.map(key => lane(key, race[key])).join("")}
`;