Skip to content

Commit

Permalink
revert multiple where
Browse files Browse the repository at this point in the history
  • Loading branch information
maceto committed Jul 23, 2024
1 parent 6965132 commit f821101
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions functions/lighthouse/libs/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ def list_data(params):
technology_array = convert_to_array(params['technology'])
data = []

query = DB.collection(TABLE)
for technology in technology_array:
query = DB.collection(TABLE)

if 'start' in params:
query = query.where(filter=FieldFilter('date', '>=', params['start']))
if 'end' in params:
query = query.where(filter=FieldFilter('date', '<=', params['end']))
if 'start' in params:
query = query.where(filter=FieldFilter('date', '>=', params['start']))
if 'end' in params:
query = query.where(filter=FieldFilter('date', '<=', params['end']))

query = query.where(filter=FieldFilter('geo', '==', params['geo']))
query = query.where(filter=FieldFilter('rank', '==', params['rank']))

for technology in technology_array:
query = query.where(filter=FieldFilter('geo', '==', params['geo']))
query = query.where(filter=FieldFilter('rank', '==', params['rank']))
query = query.where(filter=FieldFilter('technology', '==', technology))

documents = query.stream()
documents = query.stream()

for doc in documents:
data.append(doc.to_dict())
for doc in documents:
data.append(doc.to_dict())

return Result(result=data)
return Result(result=data)

0 comments on commit f821101

Please sign in to comment.