Skip to content

Commit

Permalink
Merge pull request #2172 from IntersectMBO/fix/2171-duplicated-dreps
Browse files Browse the repository at this point in the history
[#2171] eliminate duplicate DReps
  • Loading branch information
jdyczka authored Oct 18, 2024
2 parents d5c42a8 + e2b5f92 commit 27915e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ changes.

- Fix unwanted horizontal page scroll on Governance Actions page [Issue 1897](https://github.com/IntersectMBO/govtool/issues/1897)
- Fix duplicate testIds for reference errors and hints in DRep metadata form [Issue 1965](https://github.com/IntersectMBO/govtool/issues/1965)
- Eliminate duplicate DReps in the DRep Directory [Issue 2171](https://github.com/IntersectMBO/govtool/issues/2171)

### Changed

Expand Down
15 changes: 11 additions & 4 deletions govtool/backend/sql/list-dreps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SELECT
newestRegister.time AS last_register_time,
COALESCE(latestDeposit.deposit, 0),
non_deregister_voting_anchor.url IS NOT NULL AS has_non_deregister_voting_anchor,
off_chain_vote_fetch_error.fetch_error,
fetch_error.message,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
Expand Down Expand Up @@ -96,8 +96,15 @@ FROM
LEFT JOIN DRepDistr ON DRepDistr.hash_id = dh.id
AND DRepDistr.rn = 1
LEFT JOIN voting_anchor va ON va.id = dr_voting_anchor.voting_anchor_id
LEFT JOIN voting_anchor non_deregister_voting_anchor on non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
LEFT JOIN off_chain_vote_fetch_error ON off_chain_vote_fetch_error.voting_anchor_id = va.id
LEFT JOIN voting_anchor non_deregister_voting_anchor ON non_deregister_voting_anchor.id = dr_non_deregister_voting_anchor.voting_anchor_id
LEFT JOIN (
SELECT fetch_error as message, voting_anchor_id
FROM off_chain_vote_fetch_error
WHERE fetch_time = (
SELECT max(fetch_time)
FROM off_chain_vote_fetch_error)
GROUP BY fetch_error, voting_anchor_id
) AS fetch_error ON fetch_error.voting_anchor_id = va.id
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = va.id
LEFT JOIN off_chain_vote_drep_data on off_chain_vote_drep_data.off_chain_vote_data_id = off_chain_vote_data.id
CROSS JOIN DRepActivity
Expand Down Expand Up @@ -140,7 +147,7 @@ GROUP BY
newestRegister.time,
latestDeposit.deposit,
non_deregister_voting_anchor.url,
off_chain_vote_fetch_error.fetch_error,
fetch_error.message,
off_chain_vote_drep_data.payment_address,
off_chain_vote_drep_data.given_name,
off_chain_vote_drep_data.objectives,
Expand Down

0 comments on commit 27915e9

Please sign in to comment.