Mercurial > gemma
changeset 4371:4a5ed371011f
gauges: use ISRS code instead of id magic
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 11 Sep 2019 10:32:19 +0200 |
parents | 1e0d5c40b3f1 |
children | 4e6b4fd68979 5e38667f740c |
files | client/src/components/gauge/Gauges.vue |
diffstat | 1 files changed, 17 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/gauge/Gauges.vue Wed Sep 11 10:30:07 2019 +0200 +++ b/client/src/components/gauge/Gauges.vue Wed Sep 11 10:32:19 2019 +0200 @@ -109,6 +109,7 @@ * Author(s): * Markus Kottländer <markus.kottlaender@intevation.de> */ +/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "_" }]*/ import { mapState, mapGetters } from "vuex"; import { displayError } from "@/lib/errors"; @@ -245,17 +246,24 @@ return `${gauge.properties.objname} (${this.isrsInfo(gauge).orc})`; }, isrsInfo(gauge) { - let isrsInfo = gauge.id - .split(".")[1] - .replace(/[()]/g, "") - .split(","); + // See https://www.elwis.de/DE/Service/Daten-und-Fakten/RIS-Index/RIS-Index-node.html + const [ + _, + countryCode, + loCode, + fairwaySection, + orc, + hectometre + ] = gauge.properties.isrs_code.match( + /(\w{2})(\w{3})(\w{5})(\w{5})(\w{5})/ + ); return { - countryCode: isrsInfo[0], - loCode: isrsInfo[1], - fairwaySection: isrsInfo[2], - orc: isrsInfo[3], - hectometre: isrsInfo[4] + countryCode: countryCode, + loCode: loCode, + fairwaySection: fairwaySection, + orc: orc, + hectometre: hectometre }; } },