Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Fix tool form building if select filters from unavailable dataset metadata #17930

Merged
merged 1 commit into from
Apr 8, 2024
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
15 changes: 12 additions & 3 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6854,14 +6854,23 @@ def touch(self):
if self.collection:
flag_modified(self.collection, "collection_type")

def to_hda_representative(self, multiple=False):
@overload
def to_hda_representative(self, multiple: Literal[False] = False) -> Optional[HistoryDatasetAssociation]: ...

@overload
def to_hda_representative(self, multiple: Literal[True]) -> List[HistoryDatasetAssociation]: ...

def to_hda_representative(
self, multiple: bool = False
) -> Union[List[HistoryDatasetAssociation], Optional[HistoryDatasetAssociation]]:
rval = []
for dataset in self.collection.dataset_elements:
rval.append(dataset.dataset_instance)
if multiple is False:
break
if len(rval) > 0:
return rval if multiple else rval[0]
if multiple:
return rval
return rval[0] if rval else None

def _serialize(self, id_encoder, serialization_options):
rval = dict_for(
Expand Down
Loading