Add bug count and issues link to generated chart page

Display the current open bug total on the chart page and add a link to the Forgejo issues list.

Also document optional forgejo.issues_url in config.

Closes #3

Closes #2
This commit is contained in:
Edward Betts 2026-02-17 14:26:49 +00:00
parent 0aaabd8671
commit e575848c6d
3 changed files with 11 additions and 1 deletions

View file

@ -107,14 +107,19 @@ def main() -> None:
open_bugs_over_time = count_open_bugs(bug_reports)
json_data = json.dumps(open_bugs_over_time)
current_open_bug_count = open_bugs_over_time[-1][1] if open_bugs_over_time else 0
bug_list_url = config.get("forgejo", "issues_url", fallback=f"https://{hostname}/issues")
script_dir = os.path.dirname(os.path.abspath(__file__))
template_path = os.path.join(script_dir, "template.html")
with open(template_path, "r") as fh:
template_html = fh.read()
page_html = template_html.replace("jsonData = []", "jsonData = " + json_data)
page_html = page_html.replace("__OPEN_BUG_COUNT__", str(current_open_bug_count))
page_html = page_html.replace("__BUG_LIST_URL__", bug_list_url)
dest = config.get("output", "dest")
with open(dest, "w") as out:
out.write(template_html.replace("jsonData = []", "jsonData = " + json_data))
out.write(page_html)
if __name__ == "__main__":