Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#2609): fix wrong SPO vote totals #2616

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading