# HG changeset patch # User Thomas Junk # Date 1568190739 -7200 # Node ID 4a5ed371011fe1f5953c23892a61d3e3974ff19a # Parent 1e0d5c40b3f16e991df0b36691a0c48c16056de6 gauges: use ISRS code instead of id magic diff -r 1e0d5c40b3f1 -r 4a5ed371011f client/src/components/gauge/Gauges.vue --- 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 */ +/*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 }; } },