Skip to content

Commit

Permalink
fix #101 don't show +0 for pokemon needed
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnymac committed Feb 26, 2017
1 parent ac35a99 commit abc7f0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/screens/Table/components/Species.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ class Species extends React.Component {
if (specie.evolves > 0) {
const totalCandyNeeded = specie.candyToEvolve * specie.count
const extraCandyNeeded = totalCandyNeeded - specie.candy
const extraPokemonNeeded = Math.floor((extraCandyNeeded * -1) / specie.candyToEvolve)

if (extraCandyNeeded > 0) {
extraCandyNeededSpan = (
<span
Expand All @@ -157,13 +159,13 @@ class Species extends React.Component {
{` +${extraCandyNeeded}`}
</span>
)
} else if (extraCandyNeeded < 0) {
} else if (extraPokemonNeeded > 0 && extraCandyNeeded < 0) {
extraPokemonNeededSpan = (
<span
className="additional-info"
alt="Extra pokemon required to use all candy"
>
{` +${Math.floor((extraCandyNeeded * -1) / specie.candyToEvolve)}`}
{` +${extraPokemonNeeded}`}
</span>
)
}
Expand Down

0 comments on commit abc7f0c

Please sign in to comment.