From 3e5f4c3908a2e6bab036198058117f17d92075ce Mon Sep 17 00:00:00 2001 From: Sher Ali Date: Wed, 1 Mar 2023 16:59:02 +0500 Subject: [PATCH] unicode escape for superset datasets --- questionnaires/superset/utils.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/questionnaires/superset/utils.py b/questionnaires/superset/utils.py index 384f9311f..ff1ca3537 100644 --- a/questionnaires/superset/utils.py +++ b/questionnaires/superset/utils.py @@ -31,16 +31,16 @@ } CALCULATED_COLUMN_EXPRESSION_MAP = { - 'checkbox': "((form_data::json)->'{}')::text", - 'checkboxes': "trim(both '\"' from json_array_elements((form_data::json)->'{}')::TEXT)", - 'dropdown': "trim(both '\"' from ((form_data::json)->'{}')::text)", - 'email': "trim(both '\"' from ((form_data::json)->'{}')::text)", - 'singleline': "((form_data::json)->'{}')::text", - 'multiline': "((form_data::json)->'{}')::text", + 'checkbox': "unistr(((form_data::json)->'{}')::text)", + 'checkboxes': "unistr(trim(both '\"' from json_array_elements((form_data::json)->'{}')::text))", + 'dropdown': "unistr(trim(both '\"' from ((form_data::json)->'{}')::text))", + 'email': "unistr(trim(both '\"' from ((form_data::json)->'{}')::text))", + 'singleline': "unistr(((form_data::json)->'{}')::text)", + 'multiline': "unistr(((form_data::json)->'{}')::text)", 'number': "(form_data::json->>'{}')::DECIMAL", 'positivenumber': "(form_data::json->>'{}')::DECIMAL", - 'radio': "trim(both '\"' from ((form_data::json)->'{}')::text)", - 'url': "trim(both '\"' from ((form_data::json)->'{}')::text)", + 'radio': "unistr(trim(both '\"' from ((form_data::json)->'{}')::text))", + 'url': "unistr(trim(both '\"' from ((form_data::json)->'{}')::text))", }