Skip to content

Commit 6f1c515

Browse files
authored
Merge pull request #3738 from IntersectMBO/3733-bug-drep-details-page-produces-blank-screen-with-console-error-missing-group-by
fix(#3733): missing group_by updates in list-dreps.sql
2 parents 2d3a82c + ab68af6 commit 6f1c515

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

govtool/backend/sql/list-dreps.sql

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,19 @@ DRepData AS (
266266
off_chain_vote_drep_data.image_url,
267267
off_chain_vote_drep_data.image_hash,
268268
(
269-
SELECT jsonb_agg(ref)
269+
SELECT jsonb_agg(
270+
jsonb_build_object(
271+
'uri', COALESCE(
272+
CASE WHEN jsonb_typeof(ref->'uri') = 'string' THEN ref->>'uri' END,
273+
ref->'uri'->>'@value'
274+
),
275+
'@type', ref->>'@type',
276+
'label', COALESCE(
277+
CASE WHEN jsonb_typeof(ref->'label') = 'string' THEN ref->>'label' END,
278+
ref->'label'->>'@value'
279+
)
280+
)
281+
)
270282
FROM jsonb_array_elements(
271283
CASE
272284
WHEN (ocvd.json::jsonb)->'body'->'references' IS NOT NULL
@@ -277,7 +289,19 @@ DRepData AS (
277289
WHERE ref->>'@type' = 'Identity'
278290
),
279291
(
280-
SELECT jsonb_agg(ref)
292+
SELECT jsonb_agg(
293+
jsonb_build_object(
294+
'uri', COALESCE(
295+
CASE WHEN jsonb_typeof(ref->'uri') = 'string' THEN ref->>'uri' END,
296+
ref->'uri'->>'@value'
297+
),
298+
'@type', ref->>'@type',
299+
'label', COALESCE(
300+
CASE WHEN jsonb_typeof(ref->'label') = 'string' THEN ref->>'label' END,
301+
ref->'label'->>'@value'
302+
)
303+
)
304+
)
281305
FROM jsonb_array_elements(
282306
CASE
283307
WHEN (ocvd.json::jsonb)->'body'->'references' IS NOT NULL

0 commit comments

Comments
 (0)