Skip to content

Commit

Permalink
fix decimal numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
edu1910 committed Mar 4, 2023
1 parent 6376ffc commit 8d9b8d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/views/Burndown.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ const Burndown = () => {
return
}

if (day.current !== Math.min(object.days, Math.max(1, day.current))) {
if (day.current != Math.round(Math.min(object.days, Math.max(1, day.current)))) {
setError(`Dia deve ser um inteiro entre 1 e ${object.days}.`)
return
}

if (dayPoints.current !== Math.min(9999, Math.max(0, dayPoints.current))) {
if (dayPoints.current != Math.round(Math.min(9999, Math.max(0, dayPoints.current)))) {
setError('Pontos deve ser um inteiro entre 0 e 9999.')
return
}
Expand Down
10 changes: 5 additions & 5 deletions src/views/New.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ const New = () => {
} else if (e.target.name === 'points') {
let value = e.target.value
if (value) {
value = Math.min(9999, Math.max(0, e.target.value))
value = Math.round(Math.min(9999, Math.max(0, e.target.value)))
}
setPoints(value)
} else if (e.target.name === 'days') {
let value = e.target.value
if (value) {
value = Math.min(60, Math.max(0, e.target.value))
value = Math.round(Math.min(60, Math.max(0, e.target.value)))
}
setDays(value)
}
Expand All @@ -71,12 +71,12 @@ const New = () => {
return
}

if (days !== Math.min(60, Math.max(2, days))) {
if (days != Math.round(Math.min(60, Math.max(2, days)))) {
setError('Dias deve ser um inteiro entre 2 e 60.')
return
}

if (points !== Math.min(9999, Math.max(1, points))) {
if (points != Math.round(Math.min(9999, Math.max(1, points)))) {
setError('Pontos deve ser um inteiro entre 1 e 9999.')
return
}
Expand All @@ -99,7 +99,7 @@ const New = () => {

useEffect(() => {
calcIdealData()
})
}, [])

return (
<>
Expand Down

0 comments on commit 8d9b8d1

Please sign in to comment.