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

Implement sorting for search result #101

Merged
merged 2 commits into from
May 18, 2023
Merged

Implement sorting for search result #101

merged 2 commits into from
May 18, 2023

Conversation

ArtemkaKun
Copy link
Contributor

@ArtemkaKun ArtemkaKun commented May 12, 2023

This PR does 2 things:

  • removes nr_downloads field from Package structure
  • implements search results sorting logic

Sorting logic is the following:

  • by stars (descending)
  • if stars count if the same - be downloads count (descending)
  • if stars and downloads counts are the same - by the last update date (ascending)
  • if stars and downloads count and last upload date are the same - by name (A -> Z)

This PR is unrelated to #92 , since it implements default sorting logic, while an issue requests the implementation of controls to be able to choose sorting mode on the search page.

@xy3
Copy link
Contributor

xy3 commented May 13, 2023

Can we also keep the data from nr_downloads? I believe it actually does contain some download counts from the jsmod endpoint

@ArtemkaKun
Copy link
Contributor Author

Migration code of old packages should insert nr_downloads into downloads filed, if I understood a code right. So probably we just need to remigrate packages

migrate_mods.v Outdated Show resolved Hide resolved
@medvednikov
Copy link
Member

I'll take care of migrating the downloads numbers.

@medvednikov medvednikov merged commit 4b1d798 into vlang:master May 18, 2023
@ArtemkaKun ArtemkaKun deleted the implement-search-sorting branch May 22, 2023 14:31
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 this pull request may close these issues.

3 participants