mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-21 13:09:54 +02:00
Resolve Find Mods stats from each mod's GitHub repo when the feed lacks them
A FIND MODS row now shows download/date stats even when its feed publishes none: the row fetches the mod's own GitHub releases through the same cached ModUpdate.fetchReleases the MODS tab uses (six-hour options cache, so an installed mod's repo is instant). Feed-published stats still win when present; otherwise one repo is fetched per frame -- the thumbnail budget pattern -- so opening the tab never stalls for the whole listing. ModUpdate.statsForReleases is the shared resolver.
This commit is contained in:
@@ -253,4 +253,23 @@ do
|
||||
HostShell.canFetch, HostShell.httpGet = realCanFetch, realHttpGet
|
||||
end
|
||||
|
||||
-- statsForReleases: one resolver over a release list, the FIND MODS path
|
||||
do
|
||||
local stats = ModUpdate.statsForReleases({
|
||||
{ version = "1.0.0", downloads = 41, published = "2024-05-31" },
|
||||
{ version = "1.1.0", downloads = 9, published = "2025-11-02" },
|
||||
})
|
||||
eq(stats.total, 50, "total downloads across releases")
|
||||
eq(stats.first, "2024-05-31", "first release date")
|
||||
eq(stats.latest, "2025-11-02", "latest release date")
|
||||
check(ModUpdate.statsForReleases({ { version = "1.0.0" } }) == nil,
|
||||
"a list with neither counts nor dates resolves to nil")
|
||||
check(ModUpdate.statsForReleases(nil) == nil, "nil resolves to nil")
|
||||
local datesOnly = ModUpdate.statsForReleases({
|
||||
{ version = "1.0.0", published = "2024-05-31" },
|
||||
})
|
||||
eq(datesOnly.total, nil, "dates without counts keep total nil")
|
||||
eq(datesOnly.first, "2024-05-31", "but keep the date")
|
||||
end
|
||||
|
||||
print("ok mod_update_tests")
|
||||
|
||||
Reference in New Issue
Block a user