wtchg-kwiatkowski / observatory-web

0 stars 0 forks source link

In table filter criterion editor, "Is absent" for strings causes error #466

Open leehart opened 5 years ago

leehart commented 5 years ago

Variants table Add filter Add criterion Select "Chromosome" column Select "Is absent" comparison Apply See error.

Note the error doesn't occur for non-string columns, e.g. Longitude. The code uses different SQL, i.e. DQXDbTools.py

        if statm['Tpe'] == 'ISPRESENT':
            processed = True
            st = '{0} IS NOT NULL'.format(DBCOLESC(statm['ColName']))
            self.querystring += st
            self.querystring_params += st

        if statm['Tpe'] == 'ISABSENT' or \
                (statm['Tpe'] == '=' and statm['CompValue'] is None) or \
                (statm['Tpe'] == '=' and statm['CompValue'] == ''):
            processed = True
            st = '{0} IS NULL'.format(DBCOLESC(statm['ColName']))
            self.querystring += st
            self.querystring_params += st

        if statm['Tpe'] == 'ISEMPTYSTR':
            processed = True
            st = '{0}=\'\''.format(DBCOLESC(statm['ColName']))
            self.querystring += st
            self.querystring_params += st

        if statm['Tpe'] == 'ISNOTEMPTYSTR':
            processed = True
            st = '{0}<>\'\''.format(DBCOLESC(statm['ColName']))
            self.querystring += st
            self.querystring_params += st

(btw, "Is present" seems to work OK for string columns.)

leehart commented 5 years ago

I'm getting inconsistent results when trying to test/reproduce this, so I suspect the error (a 500 (Server Error)) is related to some other cause.