Skip to content

Commit

Permalink
Merge pull request #2141 from IntersectMBO/develop
Browse files Browse the repository at this point in the history
1.0.21-rc Governance Actions dates and SPO votes fixes
  • Loading branch information
MSzalowski authored Oct 15, 2024
2 parents 2469720 + 56d4ea5 commit ee64735
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ changes.

### Fixed

-
- Fix counting epoch boundaries for Governance Actions [Issue 2125](https://github.com/IntersectMBO/govtool/issues/2125)
- Fix displaying the SPO Votes [Issue 2085](https://github.com/IntersectMBO/govtool/issues/2085)

### Changed

Expand Down
41 changes: 18 additions & 23 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ SELECT
null
end
) as description,
epoch_utils.last_epoch_end_time + epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no),
CASE
WHEN meta.network_name::text = 'mainnet' THEN
epoch_utils.last_epoch_end_time +
epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no)::bigint +
INTERVAL '5 days'
ELSE
epoch_utils.last_epoch_end_time +
epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no)::bigint +
INTERVAL '1 day'
END AS expiry_date,
gov_action_proposal.expiration,
creator_block.time,
creator_block.epoch_no,
Expand All @@ -78,9 +87,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 @@ -95,6 +104,7 @@ FROM
CROSS JOIN EpochUtils AS epoch_utils
CROSS JOIN always_no_confidence_voting_power
CROSS JOIN always_abstain_voting_power
CROSS JOIN meta
JOIN tx AS creator_tx ON creator_tx.id = gov_action_proposal.tx_id
JOIN block AS creator_block ON creator_block.id = creator_tx.block_id
LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id
Expand All @@ -104,21 +114,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 +156,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 All @@ -177,4 +171,5 @@ GROUP BY
always_no_confidence_voting_power.amount,
always_abstain_voting_power.amount,
prev_gov_action.index,
prev_gov_action_tx.hash)
prev_gov_action_tx.hash,
meta.network_name)
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 ee64735

Please sign in to comment.