From 9fae0a974dbb97fef1221950e5f6c89803095133 Mon Sep 17 00:00:00 2001 From: stuppie Date: Wed, 7 Oct 2026 23:06:50 -0600 Subject: some products dont have a user_wallet entry, make the query return an empty dict if not exists --- generalresearch/managers/thl/product.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generalresearch/managers/thl/product.py b/generalresearch/managers/thl/product.py index b730f92..791ce55 100644 --- a/generalresearch/managers/thl/product.py +++ b/generalresearch/managers/thl/product.py @@ -324,7 +324,10 @@ class ProductManager(PostgresManager): bp.grs_domain AS harmonizer_domain, COALESCE(t.tags, ARRAY[]::varchar[]) AS tags, sources.value -> 'sources_config' AS sources_config, - wallet.value -> 'user_wallet' AS user_wallet_config + COALESCE( + NULLIF(wallet.value -> 'user_wallet', 'null'::jsonb), + jsonb_build_object() + ) AS user_wallet_config FROM selected_products bp LEFT JOIN LATERAL ( SELECT array_agg(pt.tag) AS tags -- cgit v1.2.3