Skip to content

Commit

Permalink
Make synclist task with policy 'exclude' include all versions not jus…
Browse files Browse the repository at this point in the history
…t is_latest AAH-485 (#783)

* Just adding CHANGES/585.txt with some notes

Issue: AAH-585

* Notes

No-Issue

* WIP: Set is_highest based on synlist.policy

Issue: AAH-585

* Fix synclist include/exclude filter.

Issue: AAH-585

Co-authored-by: Bruno Rocha <rochacbruno@gmail.com>
(cherry picked from commit 3bdecca)
  • Loading branch information
alikins authored and Patchback committed Jul 21, 2021
1 parent e93d408 commit 6a4537c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/585.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix synclist to exclude all versions of un-checked collection.
9 changes: 7 additions & 2 deletions galaxy_ng/app/tasks/synclist.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,21 @@ def curate_synclist_repository(synclist_pk, **kwargs):

namespaces = synclist.namespaces.filter().values_list("name", flat=True)

# include adds only highest version and exclude removes all versions of the collection.
is_highest_query_param = {}
if synclist.policy == 'include':
is_highest_query_param = {"is_highest": True}

collection_versions = CollectionVersion.objects.filter(
Q(
repositories=synclist.upstream_repository,
collection__namespace__in=namespaces,
is_highest=True,
**is_highest_query_param
)
| Q(
collection__in=synclist.collections.all(),
repositories=synclist.repository,
is_highest=True,
**is_highest_query_param
)
)

Expand Down

0 comments on commit 6a4537c

Please sign in to comment.