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

[#231] fix broken endpoints #232

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ with current_epoch as (
select count(*) as count
from drep_hash
), always_abstain_voting_power as (
select amount
from drep_distr
join drep_hash
select coalesce(amount, 0) as amount
from drep_hash
left join drep_distr
on drep_hash.id = drep_distr.hash_id
where drep_hash.view = 'drep_always_abstain'
order by epoch_no desc
limit 1
), always_no_confidence_voting_power as (
select amount
from drep_distr
join drep_hash
select coalesce(amount, 0) as amount
from drep_hash
left join drep_distr
on drep_hash.id = drep_distr.hash_id
where drep_hash.view = 'drep_always_no_confidence'
order by epoch_no desc
Expand Down
10 changes: 6 additions & 4 deletions govtool/backend/sql/get-voting-power.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
select drep_distr.amount
from drep_distr
join drep_hash
select coalesce(drep_distr.amount, 0) as amount
from drep_hash
left join drep_distr
on drep_hash.id = drep_distr.hash_id
where drep_hash.raw = decode(?,'hex')
where drep_hash.raw = decode(?,'hex')
order by epoch_no desc
limit 1
12 changes: 6 additions & 6 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ WITH LatestDrepDistr AS (
Max(end_time) as last_epoch_end_time
FROM epoch
), always_no_confidence_voting_power as (
select amount
from drep_distr
join drep_hash
select coalesce(amount, 0) as amount
from drep_hash
left join drep_distr
on drep_hash.id = drep_distr.hash_id
where drep_hash.view = 'drep_always_no_confidence'
order by epoch_no desc
limit 1
), always_abstain_voting_power as (
select amount
from drep_distr
join drep_hash
select coalesce(amount, 0) as amount
from drep_hash
left join drep_distr
on drep_hash.id = drep_distr.hash_id
where drep_hash.view = 'drep_always_abstain'
order by epoch_no desc
Expand Down
8 changes: 3 additions & 5 deletions govtool/backend/src/VVA/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ getVotingPower ::
Text ->
m Integer
getVotingPower drepId = withPool $ \conn -> do
votingPower <-
sum . map (\(SQL.Only x) -> x) <$>
liftIO
(SQL.query @_ @(SQL.Only Scientific) conn getVotingPowerSql $
SQL.Only drepId)
[SQL.Only votingPower] <-
liftIO
(SQL.query @_ @(SQL.Only Scientific) conn getVotingPowerSql $ SQL.Only drepId)
return $ floor votingPower

listDRepsSql :: SQL.Query
Expand Down