Skip to content

Commit

Permalink
Limit Pollution Values to Two Decimal Values
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshg6 committed May 7, 2021
1 parent ac9438c commit 5b4c659
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,17 @@ class ComponentIndex extends Component {

getCarPollutionValue() {
const factor = 0.1
const pollutionValue = this.getGco2eValue() * factor

return String(this.getGco2eValue() * factor)

return String(pollutionValue.toFixed(2))
}

getTreePollutionValue() {
const factor = 0.01
const pollutionValue = this.getGco2eValue() * factor

return String(this.getGco2eValue() * factor)
return String(pollutionValue.toFixed(2))
}

renderSecondHalf() {
Expand Down

0 comments on commit 5b4c659

Please sign in to comment.