Skip to content

Commit

Permalink
Merge pull request #1552 from disassembler/sl/fix-proposals-sql
Browse files Browse the repository at this point in the history
list-proposals: fix SQL
  • Loading branch information
bosko-m authored Jul 12, 2024
2 parents 47573b7 + 4e67563 commit d29b93e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ SELECT
/* created date */
voting_anchor.url,
encode(voting_anchor.data_hash, 'hex'),
off_chain_vote_data.title,
off_chain_vote_data.abstract,
off_chain_vote_data.motivation,
off_chain_vote_data.rationale,
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
off_chain_vote_data.json,
off_chain_vote_data.json#>'{body, references}' as references,
coalesce(Sum(ldd.amount) FILTER (WHERE voting_procedure.vote::text = 'Yes'), 0) +(
Expand Down Expand Up @@ -88,6 +88,7 @@ FROM
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
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = voting_anchor.id
LEFT JOIN off_chain_vote_gov_action_data ON off_chain_vote_gov_action_data.off_chain_vote_data_id = off_chain_vote_data.id
LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id
LEFT JOIN LatestDrepDistr ldd ON ldd.hash_id = voting_procedure.drep_voter
AND ldd.rn = 1
Expand All @@ -107,10 +108,10 @@ GROUP BY
stake_address.view,
treasury_withdrawal.amount,
creator_block.epoch_no,
off_chain_vote_data.title,
off_chain_vote_data.abstract,
off_chain_vote_data.motivation,
off_chain_vote_data.rationale,
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale,
off_chain_vote_data.json,
gov_action_proposal.index,
creator_tx.hash,
Expand Down

0 comments on commit d29b93e

Please sign in to comment.