Skip to content

Commit 4ac8675

Browse files
committed
unique list
1 parent 2b5ac75 commit 4ac8675

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

functions/technologies/libs/queries.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from google.cloud import firestore
44
from google.cloud.firestore_v1.base_query import FieldFilter, Or
55

6-
from .result import Result
6+
from .result import Result
77
from .utils import convert_to_array
88
from .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)

0 commit comments

Comments
 (0)