fix: count romset members on the Wanted page

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 20:31:39 +02:00
1 parent 5cb79bb2f7
commit d01c1b7085
2 files changed
+24 -1

No files matched your search

+4 -1
View File
@@ -84,7 +84,10 @@ def build_report(db: dict, snapshots: dict, members: dict | None = None) -> dict
split the target list is swamped by content the project never ships.
"""
by_sha1 = db.get("files", {})
members = members or {}
# The members a romset holds are held too, whoever asks: the site built
# its Wanted page without them and asked the public for the Astrocade
# and Gamate BIOS that astrocdw.zip and gamate.zip already carry.
members = archive_members(db) if members is None else members
by_md5_size = {
(entry.get("md5", ""), entry.get("size", 0)) for entry in by_sha1.values()
}
+20
View File
@@ -3373,5 +3373,25 @@ class TestsRunOffline(unittest.TestCase):
self.assertTrue(os.environ.get("RETROBIOS_OFFLINE"))
class TheWantedPageCountsRomsetMembers(unittest.TestCase):
"""The site called build_report without archive_members: the public
Wanted page asked for dumps the collection holds inside romsets."""
def test_members_are_read_unless_given(self):
from scripts import provenance_report
calls = []
def members(db):
calls.append(db)
return {}
with mock.patch.object(provenance_report, "archive_members", members):
provenance_report.build_report({"files": {}}, {})
provenance_report.build_report({"files": {}}, {}, {})
self.assertEqual(len(calls), 1)
if __name__ == "__main__":
unittest.main()