diff --git a/packages/page-council/src/Motions/Motion.tsx b/packages/page-council/src/Motions/Motion.tsx index 5e7a1eaf99..8a0c32906f 100644 --- a/packages/page-council/src/Motions/Motion.tsx +++ b/packages/page-council/src/Motions/Motion.tsx @@ -27,6 +27,7 @@ interface Props { interface VoterState { hasVoted: boolean; hasVotedAye: boolean; + hasVotedNay: boolean; } function Motion ({ className = '', isMember, members, motion: { hash, proposal, votes }, prime }: Props): React.ReactElement | null { @@ -37,15 +38,17 @@ function Motion ({ className = '', isMember, members, motion: { hash, proposal, const { hasVoted, hasVotedAye } = useMemo( (): VoterState => { if (votes) { - const hasVotedAye = allAccounts.some((address) => votes.ayes.some((accountId) => accountId.eq(address))); + const hasVotedAye = allAccounts.some((a) => votes.ayes.some((accountId) => accountId.eq(a))); + const hasVotedNay = allAccounts.some((a) => votes.nays.some((accountId) => accountId.eq(a))); return { - hasVoted: hasVotedAye || allAccounts.some((address) => votes.nays.some((accountId) => accountId.eq(address))), - hasVotedAye + hasVoted: hasVotedAye || hasVotedNay, + hasVotedAye, + hasVotedNay }; } - return { hasVoted: false, hasVotedAye: false }; + return { hasVoted: false, hasVotedAye: false, hasVotedNay: false }; }, [allAccounts, votes] ); diff --git a/packages/react-hooks/src/useVotingStatus.ts b/packages/react-hooks/src/useVotingStatus.ts index ef00160cbe..5fffb4afb8 100644 --- a/packages/react-hooks/src/useVotingStatus.ts +++ b/packages/react-hooks/src/useVotingStatus.ts @@ -41,7 +41,9 @@ function getStatus (api: ApiPromise, bestNumber: BlockNumber, votes: Votes, numM } const isEnd = bestNumber.gte(votes.end); + // let approved = yes_votes >= voting.threshold; const hasPassed = votes.threshold.lten(votes.ayes.length); + // let disapproved = seats.saturating_sub(no_votes) < voting.threshold; const hasFailed = votes.threshold.gtn(Math.abs(numMembers - votes.nays.length)); return {