From 6b9406b3953de056b642f8d27621d7e3c5dd6bbf Mon Sep 17 00:00:00 2001 From: zdenevuk <zdenko.vuk@ijs.si> Date: Mon, 19 Dec 2022 12:40:19 +0100 Subject: [PATCH] fixed duplicating of 'capacity' --- .../results-map/results-map.component.ts | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/app/pages/simulation-wizard/results-map/results-map.component.ts b/src/app/pages/simulation-wizard/results-map/results-map.component.ts index 5e207387..8257d610 100644 --- a/src/app/pages/simulation-wizard/results-map/results-map.component.ts +++ b/src/app/pages/simulation-wizard/results-map/results-map.component.ts @@ -333,20 +333,9 @@ export class ResultsMapComponent implements OnChanges { private highlightFeature(e, feature) { const layer = e.target; let text = ""; - if (feature["capacity"]) { - if (feature["capacity"] == "9999.0" || feature["capacity"] == "9999") { - text += `<span style='display: inline-block; margin-bottom: 7px; font-weight: bold;'>Oops! Looks like you clicked on an transparent bus line with capacity of 9999!</span><br>`; - } - const tmp = this.limitMyDigits(feature["capacity"]); - if ("capacity" == this.checkedRadioButton) { - text += `<u><strong>capacity:</strong> ${tmp}</u><br>`; - } else { - text += `<strong>capacity:</strong> ${tmp}<br>`; - } - text += `<span style='display: inline-block; margin-bottom: 7px; color: #666'>(unrounded) ${feature["capacity"]}</span><br>`; - } if (feature["cityWide"]) { + console.log(" we have cityWide"); for (let p in feature["cityWide"]["pollution"]) { const tmp = this.limitMyDigits(feature["cityWide"]["pollution"][p]); if (p == this.checkedRadioButton) { @@ -368,13 +357,27 @@ export class ResultsMapComponent implements OnChanges { } Object.entries(feature).forEach((element) => { - const tmp = this.limitMyDigits(element[1] as number).toString(); - if (element[0] == this.checkedRadioButton) { - text += `<u><strong>${element[0]}:</strong> ${tmp}</u><br>`; + if (element[0] == "capacity") { + // exception for capacity checking for value 9999 + if (feature["capacity"] == "9999.0" || feature["capacity"] == "9999") { + text += `<span style='display: inline-block; margin-bottom: 7px; font-weight: bold;'>Oops! Looks like you clicked on an transparent bus line with capacity of 9999!</span><br>`; + } + const tmp = this.limitMyDigits(feature["capacity"]); + if ("capacity" == this.checkedRadioButton) { + text += `<u><strong>capacity:</strong> ${tmp}</u><br>`; + } else { + text += `<strong>capacity:</strong> ${tmp}<br>`; + } + text += `<span style='display: inline-block; margin-bottom: 7px; color: #666'>(unrounded) ${feature["capacity"]}</span><br>`; } else { - text += `<strong>${element[0]}:</strong> ${tmp}<br>`; + const tmp = this.limitMyDigits(element[1] as number).toString(); + if (element[0] == this.checkedRadioButton) { + text += `<u><strong>${element[0]}:</strong> ${tmp}</u><br>`; + } else { + text += `<strong>${element[0]}:</strong> ${tmp}<br>`; + } + text += `<span style='display: inline-block; margin-bottom: 7px; color: #666'>(unrounded) ${element[1]}</span><br>`; } - text += `<span style='display: inline-block; margin-bottom: 7px; color: #666'>(unrounded) ${element[1]}</span><br>`; }); if (!text.length) -- GitLab