aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuppie2026-10-07 23:06:50 -0600
committerstuppie2026-10-07 23:06:50 -0600
commit9fae0a974dbb97fef1221950e5f6c89803095133 (patch)
treed0d4776dc4c026f1e21df2b5bc3d515c1fd66256
parentba3c0527828842bd43ad87e956d4a78c9d921542 (diff)
downloadgeneralresearch-9fae0a974dbb97fef1221950e5f6c89803095133.tar.gz
generalresearch-9fae0a974dbb97fef1221950e5f6c89803095133.zip
some products dont have a user_wallet entry, make the query return an empty dict if not exists
-rw-r--r--generalresearch/managers/thl/product.py5
1 files changed, 4 insertions, 1 deletions
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