Mercurial > gemma
diff client/src/store/fairwayavailability.js @ 4437:a075da82e875
client:FWD: change unit to meter for the generated csv file
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Thu, 19 Sep 2019 15:33:22 +0200 |
parents | 47aa3be2a7de |
children | 130e929bab8f |
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js Thu Sep 19 12:50:49 2019 +0200 +++ b/client/src/store/fairwayavailability.js Thu Sep 19 15:33:22 2019 +0200 @@ -192,8 +192,14 @@ // See docs/developers.md for an example how to directly // call this method for testing. setAvailableFairwayDepthData: (state, data) => { - state.csv = data; - const csv = data.split("\n").filter(x => x !== ""); //omit empty lines + const lines = data.split("\n"); + let [header, rest] = [lines.shift(), lines]; + // convert values to meter in the csv header + state.csv = [ + header.replace(/\d+\.?\d*/g, x => `${x / 100}m`), + ...rest + ].join("\n"); + const csv = [header, ...rest].filter(x => x !== ""); //omit empty lines // setLegend const headerEntries = csv.shift().split(",");