44The chart uses the translated totals recorded in ``TEAM.md``
55(``teammd_totals``), which the nightly maintenance run keeps in sync with
66git-blame attribution while preserving Transifex-era and restored counts, and
7- draws a pastel bar chart saved to ``reports/contributor_stats_YYYY_MM_DD .png``.
8- Older charts are pruned and the README block between the
9- ``STATS_START``/``STATS_END`` markers is refreshed.
7+ draws a pastel bar chart saved to ``reports/contributor_stats_latest .png``
8+ (fixed filename, overwritten each run). The README block between the
9+ ``STATS_START``/``STATS_END`` markers is refreshed with a new date .
1010
1111Requires: ``pip install polib matplotlib``
1212
3535
3636CHART_DIR = REPO_ROOT / "reports"
3737CHART_PREFIX = "contributor_stats_"
38- CHART_FILENAME = f"{ CHART_PREFIX } %Y_%m_%d .png"
38+ CHART_FILENAME = f"{ CHART_PREFIX } latest .png"
3939
4040README_PATH = REPO_ROOT / "README.md"
4141STATS_START = "<!-- STATS_START -->"
@@ -97,19 +97,6 @@ def draw_chart(data: list[tuple[str, int]], top_n: int) -> None:
9797 plt .tight_layout ()
9898
9999
100- def prune_old_charts (keep : Path , dry_run : bool ) -> list [Path ]:
101- removed : list [Path ] = []
102- for path in CHART_DIR .glob (f"{ CHART_PREFIX } *.png" ):
103- if path == keep :
104- continue
105- if dry_run :
106- print (f"[dry-run] would remove { path } " )
107- else :
108- path .unlink ()
109- removed .append (path )
110- return removed
111-
112-
113100def refresh_readme (chart_file : Path , dry_run : bool ) -> bool :
114101 text = README_PATH .read_text (encoding = "utf-8" )
115102 date_iso = datetime .date .today ().isoformat ()
@@ -161,8 +148,7 @@ def main() -> None:
161148 print ("No contributor data to generate chart." )
162149 return
163150
164- today = datetime .date .today ().strftime (CHART_FILENAME )
165- out_path = CHART_DIR / today
151+ out_path = CHART_DIR / CHART_FILENAME
166152
167153 draw_chart (data , args .top_n )
168154 if args .dry_run :
@@ -173,7 +159,6 @@ def main() -> None:
173159 print (f"Saved user contributions chart to { out_path } " )
174160 plt .close ()
175161
176- prune_old_charts (out_path , args .dry_run )
177162 refresh_readme (out_path , args .dry_run )
178163
179164
0 commit comments