Skip to content

Commit 9779d9e

Browse files
authored
Merge pull request #3885 from IntersectMBO/revert-3876-duplicates-in-pool-stat-table
Revert "(fix) Hotfix for duplicated entries for pools for epoch 568 on mainnet in pool_stat table"
2 parents 9c7f14a + ed0e029 commit 9779d9e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

govtool/backend/sql/list-proposals.sql

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,15 @@ RankedPoolVotes AS (
113113
vp.vote
114114
FROM
115115
voting_procedure vp
116-
WHERE
116+
WHERE
117117
vp.pool_voter IS NOT NULL
118118
AND vp.gov_action_proposal_id IN (SELECT id FROM ActiveProposals)
119-
ORDER BY
120-
vp.pool_voter,
121-
vp.gov_action_proposal_id,
119+
ORDER BY
120+
vp.pool_voter,
121+
vp.gov_action_proposal_id,
122122
vp.tx_id DESC,
123123
vp.id DESC
124124
),
125-
-- it's a hotfix for duplication issue https://github.com/IntersectMBO/cardano-db-sync/issues/1986
126-
LatestPoolStat AS (
127-
SELECT DISTINCT ON (pool_hash_id) *
128-
FROM
129-
pool_stat
130-
WHERE
131-
epoch_no = (SELECT MAX(no) FROM epoch)
132-
),
133125
PoolVotes AS (
134126
SELECT
135127
rpv.gov_action_proposal_id,
@@ -140,10 +132,10 @@ PoolVotes AS (
140132
SUM(CASE WHEN rpv.vote = 'Yes' THEN ps.voting_power ELSE 0 END) AS poolYesVotes,
141133
SUM(CASE WHEN rpv.vote = 'No' THEN ps.voting_power ELSE 0 END) AS poolNoVotes,
142134
SUM(CASE WHEN rpv.vote = 'Abstain' THEN ps.voting_power ELSE 0 END) AS poolAbstainVotes
143-
FROM
135+
FROM
144136
RankedPoolVotes rpv
145-
JOIN
146-
LatestPoolStat ps
137+
JOIN
138+
pool_stat ps
147139
ON rpv.pool_voter = ps.pool_hash_id
148140
WHERE
149141
ps.epoch_no = (SELECT MAX(no) FROM epoch)

0 commit comments

Comments
 (0)