File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
functions/technologies/libs Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 33from google .cloud import firestore
44from google .cloud .firestore_v1 .base_query import FieldFilter , Or
55
6- from .result import Result
6+ from .result import Result
77from .utils import convert_to_array
88from .presenters import Presenters
99
@@ -40,16 +40,21 @@ def list_data(params):
4040 else :
4141 if params ['sort' ] == 'origins' :
4242 query = query .order_by ('origins' , direction = firestore .Query .DESCENDING )
43-
43+
4444
4545 documents = query .stream ()
4646
47- data = []
48- for doc in documents :
47+ if onlyname :
48+ data = set ()
49+ for doc in documents :
4950 item = doc .to_dict ()
50- if onlyname :
51- data .append (item ['technology' ])
52- else :
53- data .append (Presenters .technology (doc .to_dict ()))
51+ data .append (item ['technology' ])
52+
53+ return Result (result = list (data ))
54+
55+ else :
56+ data = []
57+ for doc in documents :
58+ data .append (Presenters .technology (doc .to_dict ()))
5459
55- return Result (result = data )
60+ return Result (result = data )
You can’t perform that action at this time.
0 commit comments