Skip to content

Commit

Permalink
Merge pull request #2137 from IntersectMBO/fix/2085-spos-vote-count-s…
Browse files Browse the repository at this point in the history
…hown-instead-of-voting-power

fix(#2085): fix counting the SPO votes
  • Loading branch information
MSzalowski authored Oct 10, 2024
2 parents f9fdbd0 + 54d7fca commit 11bb2f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ changes.

### Fixed

-
- Fix displaying the SPO Votes [Issue 2085](https://github.com/IntersectMBO/govtool/issues/2085)

### Changed

Expand Down
26 changes: 5 additions & 21 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ SELECT
always_no_confidence_voting_power.amount
END) "no_votes",
coalesce(Sum(ldd_drep.amount) FILTER (WHERE voting_procedure.vote::text = 'Abstain'), 0) + always_abstain_voting_power.amount "abstain_votes",
coalesce(vp_by_pool.poolYesVotes, 0),
coalesce(vp_by_pool.poolNoVotes, 0),
coalesce(vp_by_pool.poolAbstainVotes, 0),
coalesce(Sum(ldd_pool.amount) FILTER (WHERE voting_procedure.vote::text = 'Yes'), 0),
coalesce(Sum(ldd_pool.amount) FILTER (WHERE voting_procedure.vote::text = 'No'), 0),
coalesce(Sum(ldd_pool.amount) FILTER (WHERE voting_procedure.vote::text = 'Abstain'), 0),
coalesce(vp_by_cc.ccYesVotes, 0),
coalesce(vp_by_cc.ccNoVotes, 0),
coalesce(vp_by_cc.ccAbstainVotes, 0),
Expand All @@ -104,21 +104,8 @@ FROM
LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id
LEFT JOIN LatestDrepDistr ldd_drep ON ldd_drep.hash_id = voting_procedure.drep_voter
AND ldd_drep.rn = 1
LEFT JOIN
(
SELECT
gov_action_proposal_id,
SUM(CASE WHEN vote = 'Yes' THEN 1 ELSE 0 END) AS poolYesVotes,
SUM(CASE WHEN vote = 'No' THEN 1 ELSE 0 END) AS poolNoVotes,
SUM(CASE WHEN vote = 'Abstain' THEN 1 ELSE 0 END) AS poolAbstainVotes
FROM
voting_procedure
WHERE
pool_voter IS NOT NULL
GROUP BY
gov_action_proposal_id
) vp_by_pool
ON gov_action_proposal.id = vp_by_pool.gov_action_proposal_id
LEFT JOIN LatestDrepDistr ldd_pool ON ldd_pool.hash_id = voting_procedure.pool_voter
AND ldd_pool.rn = 1
LEFT JOIN
(
SELECT
Expand Down Expand Up @@ -159,9 +146,6 @@ GROUP BY
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
vp_by_pool.poolYesVotes,
vp_by_pool.poolNoVotes,
vp_by_pool.poolAbstainVotes,
vp_by_cc.ccYesVotes,
vp_by_cc.ccNoVotes,
vp_by_cc.ccAbstainVotes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const Vote = ({ type, vote, value }: VoteProps) => (
wordBreak: "break-all",
}}
>
{type === "dReps" ? `₳ ${correctAdaFormat(value)}` : value}
{type !== "ccCommittee" ? value : `₳ ${correctAdaFormat(value)}`}
</Typography>
</Box>
);

0 comments on commit 11bb2f7

Please sign in to comment.