Skip to content

Commit

Permalink
Fixed "Float cannot represent non numeric value: NaN" when visiting a…
Browse files Browse the repository at this point in the history
… new installation of Ackee
  • Loading branch information
electerious committed Jun 27, 2021
1 parent 0922d70 commit 081bcdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [3.1.1] - 2021-06-27

### Fixed

- "Float cannot represent non numeric value: NaN" when visiting a new installation of Ackee

## [3.1.0] - 2021-06-27

> ⚠️ Contains breaking changes in the GraphQL API
Expand Down
4 changes: 4 additions & 0 deletions src/resolvers/facts.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module.exports = {
const totalCountPrevious = entries.slice(8, 15).reduce((acc, entry) => acc + entry.count, 0)
const totalDifference = totalCountCurrent - totalCountPrevious

if (totalCountPrevious === 0) return

return Math.min(Math.max(Math.round(totalDifference / totalCountPrevious * 100), -100), 100)
}),
},
Expand All @@ -36,6 +38,8 @@ module.exports = {
const totalCountPrevious = entries.slice(8, 15).reduce((acc, entry) => acc + entry.count, 0)
const totalDifference = totalCountCurrent - totalCountPrevious

if (totalCountPrevious === 0) return

return Math.min(Math.max(Math.round(totalDifference / totalCountPrevious * 100), -100), 100)
}),
},
Expand Down

0 comments on commit 081bcdd

Please sign in to comment.