Skip to content

Commit

Permalink
chore: simplify get_file_containers
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiOnGitHub committed Dec 21, 2024
1 parent 4153952 commit be3c779
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/galaxy/files/sources/dataverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,16 @@ def get_file_containers(
) -> Tuple[List[RemoteDirectory], int]:
"""Lists the Dataverse datasets in the repository."""
request_url = self.search_url
params: Dict[str, Any] = {}
params["type"] = "dataset"
params = {
"type": "dataset",
"per_page": limit or DEFAULT_PAGE_LIMIT,
"start": offset,
"q": f"title:{query}" if query else "*",
"sort": sort_by or "date",
}
if writeable:
# Only draft datasets can be written to.
# This is not tested and assumes that drafts are never public,
# i.e. we automatically only get the drafts from our user
params["fq"] = "publicationStatus:Draft"
params["per_page"] = limit or DEFAULT_PAGE_LIMIT
params["start"] = offset
params["q"] = "title:"+query if query else "*"
params["sort"] = sort_by or "date" # can be either "name" or "date"
response_data = self._get_response(user_context, request_url, params=params)
response_data = self._get_response(user_context, request_url, params)
total_hits = response_data["data"]["total_count"]
return self._get_datasets_from_response(response_data["data"]), total_hits

Expand Down

0 comments on commit be3c779

Please sign in to comment.