Skip to content

Commit 2bb31da

Browse files
committed
app, client and rank parameters added
1 parent f63670e commit 2bb31da

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

functions/report/libs/queries.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import json
23
from google.cloud import firestore
34
from .result import Result
45

@@ -8,16 +9,23 @@ def list_data(params):
89
ref = DB.collection(u'reports')
910

1011
query = ref
11-
12+
print("params", params)
1213
if 'start' in params:
1314
query = query.where('date', '>=', params['start'])
1415
if 'end' in params:
15-
query = query.where('date', '<', params['end'])
16+
query = query.where('date', '<=', params['end'])
1617
if 'category' in params:
1718
query = query.where('category', '==', params['category'])
1819
if 'geo' in params:
1920
query = query.where('geo', '==', params['geo'])
20-
21+
if 'app' in params:
22+
params_array = json.loads(params['app'])
23+
query = query.where('app', 'in', params_array)
24+
if 'client' in params:
25+
query = query.where('client', '==', params['client'])
26+
if 'rank' in params:
27+
query = query.where('rank', '==', params['rank'])
28+
2129
documents = query.stream()
2230

2331
data = {}

0 commit comments

Comments
 (0)