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("")}
`;