Skip to content

Commit

Permalink
optimized loop
Browse files Browse the repository at this point in the history
  • Loading branch information
max-ostapenko committed Feb 1, 2025
1 parent 7cf53d9 commit c58a75f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions functions/technologies/libs/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ def list_data(params):
documents = query.stream()

data = []
seen = set()
for doc in documents:
item = doc.to_dict()

if onlyname:
if onlyname and 'client' not in params:
appended_technologies = set()
for doc in documents:
item = doc.to_dict()
technology = item['technology']
if technology not in seen:
seen.add(technology)
if technology not in appended_technologies:
appended_technologies.add(technology)
data.append(technology)
else:

else:
for doc in documents:
item = doc.to_dict()
data.append(Presenters.technology(item))

return Result(result=data)

0 comments on commit c58a75f

Please sign in to comment.