Skip to content

Commit

Permalink
Merge pull request #2248 from IntersectMBO/fix/2247-cc-votes-are-wron…
Browse files Browse the repository at this point in the history
…gly-aggregated
  • Loading branch information
MSzalowski authored Oct 28, 2024
2 parents a9764b9 + 391ae0c commit 68ba0e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ changes.
### Fixed

- Fix validating metadata against the CIP standard [Issue 2233](https://github.com/IntersectMBO/govtool/issues/2233)
- Fix counting the CC votes [Issue 2247](https://github.com/IntersectMBO/govtool/issues/2247)

### Changed

Expand Down
11 changes: 8 additions & 3 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,19 @@ FROM
SUM(CASE WHEN vote = 'No' THEN 1 ELSE 0 END) AS ccNoVotes,
SUM(CASE WHEN vote = 'Abstain' THEN 1 ELSE 0 END) AS ccAbstainVotes
FROM
voting_procedure
voting_procedure AS vp
WHERE
committee_voter IS NOT NULL
vp.committee_voter IS NOT NULL
AND (vp.tx_id, vp.committee_voter, vp.gov_action_proposal_id) IN (
SELECT MAX(tx_id), committee_voter, gov_action_proposal_id
FROM voting_procedure
WHERE committee_voter IS NOT NULL
GROUP BY committee_voter, gov_action_proposal_id
)
GROUP BY
gov_action_proposal_id
) vp_by_cc
ON gov_action_proposal.id = vp_by_cc.gov_action_proposal_id

LEFT JOIN LatestDrepDistr ldd_cc ON ldd_cc.hash_id = voting_procedure.committee_voter
AND ldd_cc.rn = 1
LEFT JOIN gov_action_proposal AS prev_gov_action ON gov_action_proposal.prev_gov_action_proposal = prev_gov_action.id
Expand Down

0 comments on commit 68ba0e2

Please sign in to comment.