Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mp_api/client/contribs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def search_future(search_term):
ret = self.projects.queryProjects(**query).result() # first page
total_count, total_pages = ret["total_count"], ret["total_pages"]

if total_pages < 2:
if total_pages < 2 or ("page" in query):
return (
_convert_to_model( # type: ignore[return-value]
ret["data"],
Expand Down Expand Up @@ -828,7 +828,12 @@ def search_future(search_term):
]
responses = _run_futures(futures, total=total_count, timeout=timeout)

ret["data"].extend([resp["result"]["data"] for resp in responses.values()])
# NOTE: resp["result"]["data"] is a dict where each key is an int,
# and each value is a **list** of projects as dict
# Double iteration is necessary because of this nested structure
ret["data"].extend(
[entry for resp in responses.values() for entry in resp["result"]["data"]]
)

return (
_convert_to_model( # type: ignore[return-value]
Expand Down
Loading