From 48168cefff06435aa68e0f50d39d5e2cdd06596b Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 12 Jan 2025 12:19:08 -0500 Subject: [PATCH] case statement --- services/web/project/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index d59aa09..f74dc63 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -685,7 +685,7 @@ def product_urls(current_user): user_id = current_user["user"]["id"] PRODUCT_URL = f"""SELECT mp.id AS no, p.name AS description, mp.added::text AS date, 'https://'||''||mp.internal_url AS url, - mp.status, + (CASE WHEN mp.status=6 THEN 'Preparing' WHEN mp.status =7 THEN 'Active' ELSE 'Unknown' END) AS status, 'https://' AS http FROM members_products mp LEFT JOIN products p ON p.product_id =mp.product_id AND mp.member_id = {user_id}""" with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: