Skip to content

Commit

Permalink
Feature/fsr 472 (#267)
Browse files Browse the repository at this point in the history
* formatted rainfall values to 1dp

* just testing different ways untill AC is in

* setting rainfall to 1dp
  • Loading branch information
nikiwycherley authored Nov 9, 2021
1 parent 3d9fa1c commit e4f5c7d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/src/js/components/map/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e4f5c7d

Please sign in to comment.