Skip to content
Snippets Groups Projects
Commit 6b9406b3 authored by zdenko.vuk@ijs.si's avatar zdenko.vuk@ijs.si
Browse files

fixed duplicating of 'capacity'

parent 159dbd4a
No related branches found
No related tags found
No related merge requests found
...@@ -333,20 +333,9 @@ export class ResultsMapComponent implements OnChanges { ...@@ -333,20 +333,9 @@ export class ResultsMapComponent implements OnChanges {
private highlightFeature(e, feature) { private highlightFeature(e, feature) {
const layer = e.target; const layer = e.target;
let text = ""; 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"]) { if (feature["cityWide"]) {
console.log(" we have cityWide");
for (let p in feature["cityWide"]["pollution"]) { for (let p in feature["cityWide"]["pollution"]) {
const tmp = this.limitMyDigits(feature["cityWide"]["pollution"][p]); const tmp = this.limitMyDigits(feature["cityWide"]["pollution"][p]);
if (p == this.checkedRadioButton) { if (p == this.checkedRadioButton) {
...@@ -368,6 +357,19 @@ export class ResultsMapComponent implements OnChanges { ...@@ -368,6 +357,19 @@ export class ResultsMapComponent implements OnChanges {
} }
Object.entries(feature).forEach((element) => { Object.entries(feature).forEach((element) => {
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 {
const tmp = this.limitMyDigits(element[1] as number).toString(); const tmp = this.limitMyDigits(element[1] as number).toString();
if (element[0] == this.checkedRadioButton) { if (element[0] == this.checkedRadioButton) {
text += `<u><strong>${element[0]}:</strong> ${tmp}</u><br>`; text += `<u><strong>${element[0]}:</strong> ${tmp}</u><br>`;
...@@ -375,6 +377,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -375,6 +377,7 @@ export class ResultsMapComponent implements OnChanges {
text += `<strong>${element[0]}:</strong> ${tmp}<br>`; 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) if (!text.length)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment