Skip to content

Commit

Permalink
Merge pull request #17930 from mvdbeek/tool_form_build_fix
Browse files Browse the repository at this point in the history
[24.0] Fix tool form building if select filters from unavailable dataset metadata
  • Loading branch information
mvdbeek authored Apr 8, 2024
2 parents c2f45dd + 8616cbc commit 7278fa5
Showing 1 changed file with 12 additions and 3 deletions.
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

0 comments on commit 7278fa5

Please sign in to comment.