From 03f51aebf310faa6e407ddee250bb24ece5e829e Mon Sep 17 00:00:00 2001 From: jankun4 Date: Tue, 27 Feb 2024 11:35:24 +0100 Subject: [PATCH] [#212] fix drep/info sql query Signed-off-by: jankun4 --- govtool/backend/sql/get-drep-info.sql | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/govtool/backend/sql/get-drep-info.sql b/govtool/backend/sql/get-drep-info.sql index 65611fe76..e1bfcbbc6 100644 --- a/govtool/backend/sql/get-drep-info.sql +++ b/govtool/backend/sql/get-drep-info.sql @@ -1,7 +1,7 @@ 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 @@ -9,7 +9,6 @@ WITH DRepId AS ( 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 ( @@ -24,7 +23,7 @@ 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 @@ -32,7 +31,6 @@ WITH DRepId AS ( 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 (