# HG changeset patch # User Markus Kottlaender # Date 1541143978 -3600 # Node ID 67e9355e7a58e45938b4dfea8b0c3e14400a5e21 # Parent 2f8596a0d254cdcdf834664c677aef5e23b7541b fix lint errors diff -r 2f8596a0d254 -r 67e9355e7a58 client/src/bottlenecks/Bottlenecks.vue --- a/client/src/bottlenecks/Bottlenecks.vue Fri Nov 02 08:24:01 2018 +0100 +++ b/client/src/bottlenecks/Bottlenecks.vue Fri Nov 02 08:32:58 2018 +0100 @@ -107,45 +107,50 @@ }, methods: { filteredAndSortedBottlenecks() { - return this.bottlenecks.filter(bn => { - return bn.properties.name - .toLowerCase() - .includes(this.search.toLowerCase()); - }).sort((bnA, bnB) => { - switch (this.sortColumn) { - case "name": - if ( - bnA.properties.name.toLowerCase() < - bnB.properties.name.toLowerCase() - ) - return this.sortDirection === "ASC" ? -1 : 1; - if ( - bnA.properties.name.toLowerCase() > - bnB.properties.name.toLowerCase() - ) - return this.sortDirection === "ASC" ? 1 : -1; - return 0; + return this.bottlenecks + .filter(bn => { + return bn.properties.name + .toLowerCase() + .includes(this.search.toLowerCase()); + }) + .sort((bnA, bnB) => { + switch (this.sortColumn) { + case "name": + if ( + bnA.properties.name.toLowerCase() < + bnB.properties.name.toLowerCase() + ) + return this.sortDirection === "ASC" ? -1 : 1; + if ( + bnA.properties.name.toLowerCase() > + bnB.properties.name.toLowerCase() + ) + return this.sortDirection === "ASC" ? 1 : -1; + return 0; - case "latestMeasurement": - const currentA = bnA.properties.current || ''; - const currentB = bnB.properties.current || ''; - if (currentA < currentB) - return this.sortDirection === "ASC" ? -1 : 1; - if (currentA > currentB) - return this.sortDirection === "ASC" ? 1 : -1; - return 0; + case "latestMeasurement": { + if ( + (bnA.properties.current || "") < (bnB.properties.current || "") + ) + return this.sortDirection === "ASC" ? -1 : 1; + if ( + (bnA.properties.current || "") > (bnB.properties.current || "") + ) + return this.sortDirection === "ASC" ? 1 : -1; + return 0; + } - case "chainage": - if (bnA.properties.from < bnB.properties.from) - return this.sortDirection === "ASC" ? -1 : 1; - if (bnA.properties.from > bnB.properties.from) - return this.sortDirection === "ASC" ? 1 : -1; - return 0; + case "chainage": + if (bnA.properties.from < bnB.properties.from) + return this.sortDirection === "ASC" ? -1 : 1; + if (bnA.properties.from > bnB.properties.from) + return this.sortDirection === "ASC" ? 1 : -1; + return 0; - default: - return 0; - } - }); + default: + return 0; + } + }); }, selectSurvey(survey, bottleneck) { this.$store.commit("fairwayprofile/setSelectedMorph", survey); @@ -202,7 +207,9 @@ return current ? current.substr(0, current.length - 1) : ""; }, displayCurrentChainage(bottleneck) { - return (bottleneck.properties.from / 10) + " - " + (bottleneck.properties.to / 10); + return ( + bottleneck.properties.from / 10 + " - " + bottleneck.properties.to / 10 + ); } }, mounted() {