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

Github backend returns reversed list #642

Closed
jasontibbitts opened this issue Oct 18, 2018 · 2 comments · Fixed by #643
Closed

Github backend returns reversed list #642

jasontibbitts opened this issue Oct 18, 2018 · 2 comments · Fixed by #643
Assignees
Labels

Comments

@jasontibbitts
Copy link

I thought the new ability to sort releases by Date instead of RPM versioning might let us close the existing flag on the gargoyle package. That package switched versioning schemes, so stable-20090825 shows up as newer than the current stable-2011.1. So I switched it to Date, and now it detects 'stable-20060917` as the newest version, when in reality it is the oldest tag in the repository.

Is it possible that the sorting for the Date method is inverted?

@Zlopez
Copy link
Contributor

Zlopez commented Oct 19, 2018

The Date is sorting by date when the version was discovered. This unfortunately doesn't work on already existing versions, because these didn't saved this information. So in your case, these versions are sorted randomly.

I have in plan to implement Calendar versioning, which should be made exactly for this case.

@Zlopez
Copy link
Contributor

Zlopez commented Oct 19, 2018

I was too quick to respond :-(

In this case the issue is with the retrieval of only one version, which doesn't work well with Github backend as I see.

When we ask backend to provide us newest version, it will use version scheme set in project, in this case Date and tries to use it for sorting retrieved versions from backend to know which one is the newest, but versions doesn't have any date of discovery till they are saved to database. So what will happen?

The Date sorting is always taking None as lower value than actual date. So in this case it will work the same way as RPM version scheme, because it doesn't have data to use. So it's using the version, that was last in the list it retrieved. This will work as newest in most of the cases, but the github backend is receiving the last 50 versions, so the last is the oldest. This should be easy to fix. I just reverse the order of list before sorting.

TL;DR; I will fix it.

@Zlopez Zlopez self-assigned this Oct 19, 2018
@Zlopez Zlopez changed the title Date sorting picks oldest revision instead of newest? Github backend returns reversed list Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants