Mercurial > gemma
changeset 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 | a66275cf4490 |
children | 04bdc1f444bc |
files | client/src/store/fairwayavailability.js |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
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(",");