Skip to content

Commit 6be7620

Browse files
committed
Fix Vote distribution of ratified gov action
1 parent eea768e commit 6be7620

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/repository/proposal.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ export const fetchProposalVoteCount = async (proposalId: string, proposalIndex:
630630
SELECT
631631
g.id,
632632
b.epoch_no AS submittedEpoch,
633-
g.expiration AS expirationEpoch
633+
g.expiration AS expirationEpoch,
634+
g.ratified_epoch as ratifiedEpoch,
635+
g.dropped_epoch as droppedEpoch
634636
FROM gov_action_proposal g
635637
JOIN tx ON tx.id = g.tx_id
636638
JOIN block b ON b.id = tx.block_id
@@ -671,7 +673,9 @@ export const fetchProposalVoteCount = async (proposalId: string, proposalIndex:
671673
-- Determine the latest epoch to consider for voting calculations
672674
SELECT LEAST(
673675
(SELECT e.no FROM epoch e ORDER BY e.id DESC LIMIT 1),
674-
(SELECT g.expirationEpoch FROM ga g)
676+
(SELECT g.expirationEpoch FROM ga g),
677+
(SELECT g.ratifiedEpoch from ga g),
678+
(SELECT g.droppedEpoch from ga g)
675679
) AS epoch
676680
)
677681
@@ -1020,17 +1024,17 @@ export const fetchProposalVotes = async (
10201024
FROM voting_procedure vp
10211025
JOIN govAction
10221026
ON vp.gov_action_proposal_id = govAction.id
1023-
JOIN tx
1027+
JOIN tx
10241028
ON tx.id = vp.tx_id
1025-
JOIN block b
1029+
JOIN block b
10261030
ON b.id = tx.block_id
1027-
JOIN tx_out txo
1031+
JOIN tx_out txo
10281032
ON txo.tx_id = tx.id
1029-
LEFT JOIN drep_hash dh
1033+
LEFT JOIN drep_hash dh
10301034
ON dh.id = vp.drep_voter
1031-
LEFT JOIN pool_hash ph
1035+
LEFT JOIN pool_hash ph
10321036
ON ph.id = vp.pool_voter
1033-
LEFT JOIN committee_hash ch
1037+
LEFT JOIN committee_hash ch
10341038
ON ch.id = vp.committee_voter
10351039
JOIN latestEpoch
10361040
ON True

0 commit comments

Comments
 (0)