From d4367e017a5329425b98823334a0c9765c4be951 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 30 Apr 2024 17:55:21 +0200 Subject: [PATCH] Velopark: drop data if undefined --- src/Logic/Web/LinkedDataLoader.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Logic/Web/LinkedDataLoader.ts b/src/Logic/Web/LinkedDataLoader.ts index 1528b4323..2d02c611c 100644 --- a/src/Logic/Web/LinkedDataLoader.ts +++ b/src/Logic/Web/LinkedDataLoader.ts @@ -331,6 +331,9 @@ export default class LinkedDataLoader { return } output[key] = output[key].map((v) => applyF(v)) + if(!output[key].some(v => v !== undefined)){ + delete output[key] + } } function asBoolean(key: string, invert: boolean = false) { @@ -379,6 +382,7 @@ export default class LinkedDataLoader { } return "€" + Number(p) }) + if (output["charge"] && output["timeUnit"]) { const duration = Number(output["chargeEnd"] ?? "1") - Number(output["chargeStart"] ?? "0")