Skip to content

Commit

Permalink
[#212] fix drep/info sql query
Browse files Browse the repository at this point in the history
Signed-off-by: jankun4 <michaljankun@gmail.com>
  • Loading branch information
jankun4 committed Feb 27, 2024
1 parent 692140f commit 03f51ae
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions govtool/backend/sql/get-drep-info.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
WITH DRepId AS (
SELECT decode(?, 'hex') as raw
), IsRegisteredAsDRep AS (
SELECT (deposit>0) as value,
SELECT (drep_registration.voting_anchor_id is not null and deposit>0) as value,
deposit as deposit
FROM drep_registration
JOIN drep_hash
ON drep_hash.id = drep_registration.drep_hash_id
CROSS JOIN DRepId
WHERE drep_hash.raw = DRepId.raw
and deposit is not null
and drep_registration.voting_anchor_id is not null
ORDER BY drep_registration.tx_id DESC
LIMIT 1
), WasRegisteredAsDRep AS (
Expand All @@ -24,15 +23,14 @@ WITH DRepId AS (
and drep_registration.voting_anchor_id is not null
)) as value
), IsRegisteredAsSoleVoter AS (
SELECT (deposit>0) as value,
SELECT (drep_registration.voting_anchor_id is null and deposit>0) as value,
deposit as deposit
FROM drep_registration
JOIN drep_hash
ON drep_hash.id = drep_registration.drep_hash_id
CROSS JOIN DRepId
WHERE drep_hash.raw = DRepId.raw
and deposit is not null
and drep_registration.voting_anchor_id is null
ORDER BY drep_registration.tx_id DESC
LIMIT 1
), WasRegisteredAsSoleVoter AS (
Expand Down

0 comments on commit 03f51ae

Please sign in to comment.