Skip to content

Commit

Permalink
fix(#2609): fix wrong SPO vote totals
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Jan 9, 2025
1 parent db747ed commit 0f647be
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 192 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

-
- Fix counting submitted votes [Issue 2609](https://github.com/IntersectMBO/govtool/issues/2609)

### Changed

Expand Down
13 changes: 13 additions & 0 deletions govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ total_stake_controlled_by_dreps AS (
SUM(dd.amount)::bigint AS total
FROM
drep_distr dd
WHERE
dd.epoch_no = (SELECT no FROM current_epoch)
),
total_stake_controlled_by_spos AS (
SELECT
SUM(ps.stake)::bigint AS total
FROM
pool_stat ps
WHERE
ps.epoch_no = (SELECT no FROM current_epoch)
),
total_registered_direct_voters AS (
SELECT
Expand Down Expand Up @@ -176,6 +186,7 @@ SELECT
total_drep_votes.count as total_drep_votes,
total_registered_dreps.unique_registrations as total_registered_dreps,
COALESCE(total_stake_controlled_by_dreps.total, 0) as total_stake_controlled_by_dreps,
COALESCE(total_stake_controlled_by_spos.total, 0) as total_stake_controlled_by_spos,
total_active_dreps.unique_active_drep_registrations as total_active_dreps,
total_inactive_dreps.total_inactive_dreps as total_inactive_dreps,
total_active_cip119_compliant_dreps.unique_active_cip119_compliant_drep_registrations as total_active_cip119_compliant_dreps,
Expand All @@ -192,6 +203,7 @@ FROM
CROSS JOIN total_drep_votes
CROSS JOIN total_registered_dreps
CROSS JOIN total_stake_controlled_by_dreps
CROSS JOIN total_stake_controlled_by_spos
CROSS JOIN total_active_dreps
CROSS JOIN total_inactive_dreps
CROSS JOIN total_active_cip119_compliant_dreps
Expand All @@ -208,6 +220,7 @@ GROUP BY
total_drep_votes.count,
total_registered_dreps.unique_registrations,
total_stake_controlled_by_dreps.total,
total_stake_controlled_by_spos.total,
total_active_dreps.unique_active_drep_registrations,
total_inactive_dreps.total_inactive_dreps,
total_active_cip119_compliant_dreps.unique_active_cip119_compliant_drep_registrations,
Expand Down
Loading

0 comments on commit 0f647be

Please sign in to comment.