Skip to content

Commit 7cf53d9

Browse files
committed
regroup
1 parent 13f78c5 commit 7cf53d9

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

functions/technologies/libs/queries.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@ def list_data(params):
4444

4545
documents = query.stream()
4646

47-
if onlyname:
48-
data = set()
49-
for doc in documents:
50-
item = doc.to_dict()
51-
data.add(item['technology'])
52-
53-
data = list(data)
54-
data.sort()
55-
56-
else:
57-
data = []
58-
for doc in documents:
59-
data.append(Presenters.technology(doc.to_dict()))
47+
data = []
48+
seen = set()
49+
for doc in documents:
50+
item = doc.to_dict()
51+
52+
if onlyname:
53+
technology = item['technology']
54+
if technology not in seen:
55+
seen.add(technology)
56+
data.append(technology)
57+
else:
58+
data.append(Presenters.technology(item))
6059

6160
return Result(result=data)

0 commit comments

Comments
 (0)