mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-12-06 07:34:00 +00:00
fix(ui): rank most requested packages by the stored download counts
The ranking read in-memory analytics, so it was empty after every restart while the Downloads chart and the package pages read the database. It now sums the stored counts per package, counts a Go module once by its zip, and says which ranking is kept across restarts and which is not.
This commit is contained in:
@@ -50,6 +50,7 @@ export function serveRows(url: string, all: readonly Package[]) {
|
||||
return 0
|
||||
})
|
||||
}
|
||||
if (sort === 'downloads') matched.sort((a, b) => (params.get('order') === 'asc' ? 1 : -1) * (a.download_count - b.download_count))
|
||||
return {
|
||||
packages: matched.slice((page - 1) * pageSize, page * pageSize),
|
||||
total: matched.length,
|
||||
|
||||
Reference in New Issue
Block a user