Skip to content

Commit

Permalink
Add method to hda_repo; use in services.histories
Browse files Browse the repository at this point in the history
get_with_filter_order_by_hid
  • Loading branch information
jdavcs committed Aug 17, 2023
1 parent 9858cb8 commit bae13b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/galaxy/model/repositories/hda.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
List,
)

from sqlalchemy import select

from galaxy.model import HistoryDatasetAssociation
from galaxy.model.repositories import (
BaseRepository,
Expand Down
10 changes: 3 additions & 7 deletions lib/galaxy/webapps/galaxy/services/histories.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from sqlalchemy import (
false,
select,
true,
)

Expand All @@ -42,6 +41,7 @@
from galaxy.managers.notification import NotificationManager
from galaxy.managers.users import UserManager
from galaxy.model.base import transaction
from galaxy.model.repositories.hda import HistoryDatasetAssociationRepository as hda_repo
from galaxy.model.store import payload_to_source_uri
from galaxy.schema import (
FilterQueryParams,
Expand Down Expand Up @@ -641,13 +641,9 @@ def get_custom_builds_metadata(
installed_builds = []
for build in glob.glob(os.path.join(trans.app.config.len_file_path, "*.len")):
installed_builds.append(os.path.basename(build).split(".len")[0])

stmt = (
select(model.HistoryDatasetAssociation)
.filter_by(history=history, extension="fasta", deleted=False)
.order_by(model.HistoryDatasetAssociation.hid.desc())
fasta_hdas = hda_repo(trans.sa_session).get_with_filter_order_by_hid(
history=history, extension="fasta", deleted=False
)
fasta_hdas = trans.sa_session.scalars(stmt)
return CustomBuildsMetadataResponse(
installed_builds=[LabelValuePair(label=ins, value=ins) for ins in installed_builds],
fasta_hdas=[
Expand Down

0 comments on commit bae13b5

Please sign in to comment.