File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,29 @@ def list_data(params):
9
9
ref = DB .collection (u'categories' )
10
10
11
11
query = ref
12
- print ( "params" , params )
12
+
13
13
if 'category' in params :
14
- query = query .where ('category' , '==' , params ['category' ])
14
+ category_array = json .loads (params ['category' ])
15
+ query = query .where ('category' , 'in' , category_array )
16
+
15
17
if 'technologies' in params :
16
18
params_array = json .loads (params ['technologies' ])
17
19
query = query .where ('technologies' , 'in' , params_array )
18
20
19
21
documents = query .stream ()
20
22
21
23
data = []
22
- for doc in documents :
24
+
25
+ if 'onlyname' in params :
26
+
27
+ for doc in documents :
28
+ item = doc .to_dict ()
29
+ if 'category' in item :
30
+ data .append (item ['category' ])
31
+
32
+ else :
33
+
34
+ for doc in documents :
23
35
data .append (doc .to_dict ())
24
36
25
37
return Result (result = data )
Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ def __init__(self, params):
9
9
def validate (self ):
10
10
result = Result (status = "ok" , result = "()" )
11
11
12
- if 'category' not in self .params :
13
- self .add_error ("category" , "missing category parameter" )
12
+ if 'onlyname' not in self .params :
13
+ if 'category' not in self .params :
14
+ self .add_error ("category" , "missing category parameter" )
14
15
15
16
return Result (errors = self .errors , result = self .params )
16
17
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def list_data(params):
17
17
if 'geo' in params :
18
18
query = query .where ('geo' , '==' , params ['geo' ])
19
19
if 'technology' in params :
20
- params_array = json .loads (params ['app ' ])
20
+ params_array = json .loads (params ['technology ' ])
21
21
query = query .where ('technology' , 'in' , params_array )
22
22
if 'rank' in params :
23
23
query = query .where ('rank' , '==' , params ['rank' ])
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def list_data(params):
17
17
if 'geo' in params :
18
18
query = query .where ('geo' , '==' , params ['geo' ])
19
19
if 'technology' in params :
20
- params_array = json .loads (params ['app ' ])
20
+ params_array = json .loads (params ['technology ' ])
21
21
query = query .where ('technology' , 'in' , params_array )
22
22
if 'rank' in params :
23
23
query = query .where ('rank' , '==' , params ['rank' ])
You can’t perform that action at this time.
0 commit comments