fix: name every export change on the site page

The run's summary and the exports page each built the sentence from their
own table, and the page dropped sizes and hashes removed and md5 lists.
Both now read one table of change kinds, and each report stores a count
per kind. The committed reports gain those counts from their own records.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 02:26:45 +01:00
1 parent 74c59ad3b9
commit 04e1d2d3ab
20 files changed
+227 -63

No files matched your search

+6 -20
View File
@@ -12,6 +12,7 @@ import json
from pathlib import Path
from core.text import count_text
from model.exportchanges import change_phrases
from sitegen import markup
EXPORTS_DIR = "exports"
@@ -95,24 +96,15 @@ def _lookup_only(block: list[str]) -> list[str]:
def change_text(report: dict) -> str:
"""What the updated file changes, from the report's numbers.
The command line prints its own terse summary. The page states each
kind of change once, in plain terms, and leaves out what did not
happen. RetroPie's unit is a package, so its own sentence is kept.
The page names the changes the run's summary names, in plain terms,
and leaves out what did not happen. RetroPie's unit is a package, so
its own sentence is kept.
"""
counts = report.get("counts")
if not counts:
return report["summary"]
parts = [f"{count_text(counts['kept'], 'entry', 'entries')} kept"]
extra = [
(counts["added"], "file", "files", "added"),
(len(report.get("hashes_updated") or []), "hash", "hashes", "updated"),
(report.get("required_aligned") or 0, "required flag", "required flags",
"aligned with the code"),
(len(report.get("hashes_filled") or []), "hash", "hashes", "added"),
(len(report.get("sizes_updated") or []), "size", "sizes", "updated"),
]
parts += [f"{count_text(n, one, many)} {verb}" for n, one, many, verb in extra if n]
return ", ".join(parts)
kept = f"{count_text(counts['kept'], 'entry', 'entries')} kept"
return ", ".join([kept, *change_phrases(counts, plain=True)])
# Beyond this many entries a reason's list folds away.
@@ -301,12 +293,6 @@ def generate_exports_page(reports: list[dict], names: dict[str, str]) -> str:
"reasons above.",
"",
])
if counts.get("not_kept"):
lines.extend([
f"{count_text(counts['not_kept'], 'entry', 'entries')} of the original "
"cannot be written in this format and should be checked by hand.",
"",
])
lines.extend(candidate_lines(report.get("removal_candidates") or []))
lines.extend(doubled_lines(report.get("doubled") or []))
if report.get("invalid"):