From e4f5c7d8a11ad52d867571bc8169e293cc1ccef4 Mon Sep 17 00:00:00 2001 From: nikiwycherley Date: Tue, 9 Nov 2021 13:14:49 +0000 Subject: [PATCH] Feature/fsr 472 (#267) * formatted rainfall values to 1dp * just testing different ways untill AC is in * setting rainfall to 1dp --- server/src/js/components/map/live.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/src/js/components/map/live.js b/server/src/js/components/map/live.js index bee21e76d..dce2a0340 100644 --- a/server/src/js/components/map/live.js +++ b/server/src/js/components/map/live.js @@ -423,6 +423,20 @@ function LiveMap (mapId, options) { model.state = feature.get('state') model.name = capitalise(model.station_name) } + + // format rainfall to 1dp + model.one_hr_total = isNaN(model.one_hr_total) + ? null + : (Math.round(model.one_hr_total * 10) / 10).toFixed(1) + + model.six_hr_total = isNaN(model.six_hr_total) + ? null + : (Math.round(model.six_hr_total * 10) / 10).toFixed(1) + + model.day_total = isNaN(model.day_total) + ? null + : (Math.round(model.day_total * 10) / 10).toFixed(1) + const html = window.nunjucks.render('info-live.html', { model: model }) feature.set('html', html) }