Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Kipchirchir Sigei <[email protected]>
  • Loading branch information
KipSigei committed Mar 18, 2023
1 parent 413d175 commit 9faec32
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions onadata/apps/viewer/parsed_instance_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,19 @@ def _parse_where(query, known_integers, known_decimals, or_where, or_params):
except ValueError:
pass
if field_key in NONE_JSON_FIELDS:
where_params.append(text(_v))
where_params.extend([text(_v)])
else:
where_params.append(text(_v))
where.append(f"{field_key} = %s")
where_params.extend((field_key, text(_v)))
else:
if field_key in NONE_JSON_FIELDS:
where.append(f"{NONE_JSON_FIELDS[field_key]} = %s")
where_params.append(text(field_value))
elif field_value is None:
where.append(f"json->>%s IS NULL")
where.append("json->>%s IS NULL")
where_params.append(field_key)
else:
where.append(f"json->>%s = %s")
where_params.append(field_key)
where_params.append(text(field_value))
where.append("json->>%s = %s")
where_params.extend((field_key, text(field_value)))

return where + or_where, where_params + or_params

Expand Down

0 comments on commit 9faec32

Please sign in to comment.