Don't show change calc when other side is 0 (#2543)
This commit is contained in:
parent
ddb3f03d09
commit
ce779c5464
@ -75,7 +75,7 @@ function ReferendumVotes ({ change, className, count, index, isWinning, total, v
|
||||
<Tooltip
|
||||
text={
|
||||
isWinning
|
||||
? t('That amount this total can be reduced by to change the referendum outcome. This assumes changes to the convictions of the existing votes, with not additional turnout.')
|
||||
? t('The amount this total can be reduced by to change the referendum outcome. This assumes changes to the convictions of the existing votes, with not additional turnout.')
|
||||
: t('The amount this total should be increased by to change the referendum outcome. This assumes additional turnout with new votes at 1x conviction.')
|
||||
}
|
||||
trigger={trigger}
|
||||
|
||||
@ -126,14 +126,18 @@ export function approxChanges (threshold: VoteThreshold, sqrtElectorate: BN, sta
|
||||
inc = nextInc;
|
||||
}
|
||||
|
||||
// for the cases where we start at 0, we could have a value slightly higher than available,
|
||||
// cleanup, never having more than the max already available to us
|
||||
// - When the other vote is zero, it is not useful to show the decrease, since it ends up at all
|
||||
// - Always ensure that we don't go above max available (generally should be covered by above)
|
||||
return {
|
||||
changeAye: isPassing
|
||||
? BN.min(changeAye, state.votedAye)
|
||||
: changeAye,
|
||||
changeNay: isPassing
|
||||
? changeNay
|
||||
: BN.min(changeNay, state.votedNay)
|
||||
changeAye: state.votedNay.isZero()
|
||||
? ZERO
|
||||
: isPassing
|
||||
? BN.min(changeAye, state.votedAye)
|
||||
: changeAye,
|
||||
changeNay: state.votedAye.isZero()
|
||||
? ZERO
|
||||
: isPassing
|
||||
? changeNay
|
||||
: BN.min(changeNay, state.votedNay)
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user