Make notnulls set instead of list.

This commit is contained in:
voussoir 2017-09-23 11:00:37 -07:00
parent 26a034c9a0
commit 38e72c0c3a
2 changed files with 6 additions and 6 deletions

View file

@ -630,15 +630,15 @@ class PDBPhotoMixin:
searchhelpers.minmax('duration', duration, minimums, maximums, warning_bag=warning_bag) searchhelpers.minmax('duration', duration, minimums, maximums, warning_bag=warning_bag)
orderby = searchhelpers.normalize_orderby(orderby) orderby = searchhelpers.normalize_orderby(orderby)
notnulls = [] notnulls = set()
if extension or mimetype: if extension or mimetype:
notnulls.append('extension') notnulls.add('extension')
if width or height or ratio or area: if width or height or ratio or area:
notnulls.append('width') notnulls.add('width')
if bytes: if bytes:
notnulls.append('bytes') notnulls.add('bytes')
if duration: if duration:
notnulls.append('duration') notnulls.add('duration')
if orderby is None: if orderby is None:
giveback_orderby = None giveback_orderby = None

View file

@ -20,7 +20,7 @@ def build_query(orderby, notnulls, minimums, maximums, mmf_results=None):
for (column, direction) in orderby: for (column, direction) in orderby:
if column != 'RANDOM()': if column != 'RANDOM()':
notnulls.append(column) notnulls.add(column)
for column in notnulls: for column in notnulls:
wheres.append(column + ' IS NOT NULL') wheres.append(column + ' IS NOT NULL')