From 851201f38a391e95dafea4985cdf925131654747 Mon Sep 17 00:00:00 2001 From: jankun4 Date: Tue, 9 Apr 2024 12:13:26 +0200 Subject: [PATCH] [#676] fix drep/info SQL error Signed-off-by: jankun4 --- CHANGELOG.md | 1 + govtool/backend/sql/get-drep-info.sql | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2524c51f9..5f42ac266 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ changes. ### Fixed +- drep/info no longer returns 500 [Issue 676](https://github.com/IntersectMBO/govtool/issues/676) - proposal/list search is case insensitive now [Issue 582](https://github.com/IntersectMBO/govtool/issues/582) - proposal/list now takes optional `search` query param [Issue 566](https://github.com/IntersectMBO/govtool/issues/566) - Fix possible sql error when there would be no predefined drep voting pwoer [Issue 501](https://github.com/IntersectMBO/govtool/issues/501) diff --git a/govtool/backend/sql/get-drep-info.sql b/govtool/backend/sql/get-drep-info.sql index a7b4536a5..899969be7 100644 --- a/govtool/backend/sql/get-drep-info.sql +++ b/govtool/backend/sql/get-drep-info.sql @@ -5,7 +5,7 @@ WITH DRepId AS ( LatestRegistrationEntry AS ( SELECT drep_registration.voting_anchor_id AS voting_anchor_id, - deposit AS deposit + drep_registration.deposit AS deposit, tx.hash as tx_hash FROM drep_registration @@ -98,7 +98,7 @@ SELECT CurrentMetadata.url, CurrentMetadata.data_hash, CurrentVotingPower.amount, - LatestRegistrationEntry.tx_hash + encode(LatestRegistrationEntry.tx_hash, 'hex') as tx_hash FROM IsRegisteredAsDRep CROSS JOIN IsRegisteredAsSoleVoter @@ -107,3 +107,4 @@ FROM CROSS JOIN CurrentDeposit CROSS JOIN CurrentMetadata CROSS JOIN CurrentVotingPower + CROSS JOIN LatestRegistrationEntry