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

Sorting of releases with multi digit version parts #199

Closed
BiNZGi opened this issue Feb 22, 2021 · 3 comments · Fixed by #1651
Closed

Sorting of releases with multi digit version parts #199

BiNZGi opened this issue Feb 22, 2021 · 3 comments · Fixed by #1651

Comments

@BiNZGi
Copy link
Member

BiNZGi commented Feb 22, 2021

The minor version of Elasticsearch can be double digit, e.g. 7.10 and 7.11. The sorting by releaseCycle is wrong in this case, e.g. 7.9, 7.8, 7.7, 7.6, 7.5, 7.4, 7.3, 7.2, 7.1, 7.11, 7.10.

In #195 I did a workaround with a virtual number in cycleShortHand and sorted by this. I think this could be a problem also in other tools.

The idea is to extend the sorting of such version numbers in _layouts/post.html.

@captn3m0
Copy link
Member

captn3m0 commented Apr 7, 2021

The sort_natural filter doesn't work, so perhaps we need a sort_version filter of our own.

@generalmimon
Copy link
Member

generalmimon commented Sep 15, 2022

@usta @captn3m0 Um, I may be missing something obvious at the moment, but why exactly are we letting the stupid machine reorder our releases (and often screw it up) in the first place?

I see that the sorting was introduced in #42, which references issue #25. And @captn3m0 writes this in the initial issue comment #25 (comment):

It makes sense to sort by release date (in desc order
so newer releases are at the top).

(...)

Since releases are a map currently, it is hard to sort them.

This is no longer relevant, because releases are lists now, not maps. See just about any product page source:

releases:
- releaseCycle: "3.10"
eol: 2026-10-04
latest: "3.10.7"
latestReleaseDate: 2022-09-05
releaseDate: 2021-10-04
- releaseCycle: "3.9"
eol: 2025-10-05
latest: "3.9.14"
latestReleaseDate: 2022-09-06
releaseDate: 2020-10-05
- releaseCycle: "3.8"

Lists in YAML are guaranteed to preserve order, so the sorting is not needed - if you don't sort it, it will always have exactly the same order in which you specify individual releases.

So I really think we should drop this entire | sort thing here:

{% assign sorted_releases = page.releases | sort: page.sortReleasesBy | reverse %}
{% for r in sorted_releases %}

and just {% for r in page.releases %}. By doing this, we finally put trust into humans that they know in what order they want releases to be displayed.

@captn3m0
Copy link
Member

I like this idea, would clean up the code as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants