Project

General

Profile

0001-feeder-fix-value_label-SQL-for-boolean-fields-fixes-.patch

Benjamin Dauvergne, 07 Feb 2019 11:44 PM

Download (1.71 KB)

View differences:

Subject: [PATCH] feeder: fix value_label SQL for boolean fields (fixes #30477)

 tests/olap.model   | 2 +-
 wcs_olap/feeder.py | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
tests/olap.model
263 263
             "name": "bool",
264 264
             "type": "bool",
265 265
             "value": "\"field_bool\"",
266
             "value_label": "(case when \"field_bool\" IS NOT NULL then 'Oui' else 'Non' end)"
266
             "value_label": "(CASE WHEN \"field_bool\" IS NULL THEN NULL WHEN \"field_bool\" THEN 'Oui' ELSE 'Non' END)"
267 267
            }
268 268
         ],
269 269
         "fact_table" : "formdata_demande",
wcs_olap/feeder.py
902 902
                    'label': field.label.lower(),
903 903
                    'type': 'bool',
904 904
                    'value': '"field_%s"' % field.varname,
905
                    'value_label': '(case when "field_%s" IS NOT NULL then \'Oui\' else \'Non\' end)' % field.varname,
905
                    'value_label': '(CASE WHEN "field_%(varname)s" IS NULL THEN NULL'
906
                                   ' WHEN "field_%(varname)s" THEN \'Oui\''
907
                                   ' ELSE \'Non\' END)' % {
908
                        'varname': field.varname,
909
                    },
906 910
                    'filter': True,
907 911
                }
908 912
            elif field.type == 'string':
909
-