Skip to content

Commit

Permalink
[#2171] eliminate duplicate DReps
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dyczka committed Oct 17, 2024
1 parent bc73a86 commit 1107747
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ changes.

### Fixed

-
- 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 1107747

Please sign in to comment.