Skip to content

Commit

Permalink
Fix a bug where metric units incorrectly displayed as NaN when they d…
Browse files Browse the repository at this point in the history
…id not exist.
  • Loading branch information
ecc521 committed Jun 27, 2020
1 parent 0a541f2 commit 6cc4a09
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/index.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/River.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ function addFlowData(river) {

Object.defineProperty(river, "meters", {
get: function getLatestMeters() {
if (!river.feet) {return undefined}
return Math.round(river.feet / meterInFeet * 100) / 100 //Round to 2 digits
}
})

Object.defineProperty(river, "cms", {
get: function getLatestCubicMeters() {
if (!river.cfs) {return undefined}
return Math.round(river.cfs / cubicMeterInFeet * 100) / 100 //Round to 2 digits
}
})
Expand Down Expand Up @@ -227,7 +229,7 @@ function River(locate, event) {
this.writeup = this.writeup || ""
//Convert the numeric value to the filename


this.rating = parseFloat(this.rating)
//Consider allowing ratings less than 1.
if (this.rating < 1 || this.rating > 5 || isNaN(this.rating) || this.rating === undefined) {
Expand Down

0 comments on commit 6cc4a09

Please sign in to comment.