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:
2026-11-24 02:06:14 +00:00
parent 798fadb4bb
commit a685b71c7f
5 changed files with 111 additions and 8 deletions
+1
View File
@@ -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,