-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fix wrong version ordering in x-repo search #1517
Fix wrong version ordering in x-repo search #1517
Conversation
674485e
to
03d0761
Compare
@mdellweg would it be better to add the |
No, let's keep it here for. I think this is not the last iteration of it. Looks a bit naive to me. Are any letters allowed in ansible collection versions? How does it react to "1.0.0-beta"? |
good point. I checked and yes, they are allowed. We can theoretically have versions like 1.0.0-beta or 1.0.0-rc. So my solution doesn't really solve it, I can remove letters with regex for example, but then again sorting will be wrong. |
|
David told me about this is correct, but sorts pre-released version incorrectly:
reversed order sorts pre-released correctly, but is wrong
|
fixes: pulp#1516
34c17b2
to
478463b
Compare
Updated sorting, now the sorting works correctly even with the prerelease part.
|
Can you enable postgres debug logging and show us the raw sql this annotation is adding to the query? |
@jctanner hmm... for some reason the annotated field
https://gist.github.com/jerabekjiri/8eb71d6e0764f8761e5443df53b6440e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine, but it needs a functional test.
pulp_ansible/tests/functional/api/collection/v3/test_collection_version_search.py
Outdated
Show resolved
Hide resolved
pulp_ansible/tests/functional/api/collection/v3/test_collection_version_search.py
Outdated
Show resolved
Hide resolved
fixes: pulp#1516
f"{order}collection_version__version_major", | ||
f"{order}collection_version__version_minor", | ||
f"{order}collection_version__version_patch", | ||
f"{order}prerelease", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these happen to be alright in alphabetical order.
@@ -64,7 +83,6 @@ class CollectionVersionSearchFilter(FilterSet): | |||
"collection_version__pulp_created": "pulp_created", | |||
"collection_version__namespace": "namespace", | |||
"collection_version__name": "name", | |||
"collection_version__version": "version", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this change doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, since we have a custom SemanticVersionOrderingFilter
, we don't want this incorrect sorting by collection version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, now that i can see it on the large screen...
pulp_ansible/tests/functional/api/collection/v3/test_collection_version_search.py
Show resolved
Hide resolved
@@ -64,7 +83,6 @@ class CollectionVersionSearchFilter(FilterSet): | |||
"collection_version__pulp_created": "pulp_created", | |||
"collection_version__namespace": "namespace", | |||
"collection_version__name": "name", | |||
"collection_version__version": "version", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, now that i can see it on the large screen...
fix: #1516
AAH issue: AAH-2581