From e29c5899aa365e81e31a9a5f7db175169409cbc1 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Fri, 22 Dec 2023 19:56:27 +0000 Subject: [PATCH 1/3] Add zoom and pan --- template.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/template.html b/template.html index d83f15d..c91701a 100644 --- a/template.html +++ b/template.html @@ -5,6 +5,8 @@ Open bugs over time + + @@ -31,7 +33,20 @@ document.addEventListener('DOMContentLoaded', function () { data: data }] }, + options: { + plugins: { + zoom: { + pan: { + enabled: true, + }, + zoom: { + wheel: { enabled: true }, + pinch: { enabled: true }, + mode: 'xy', + } + } + }, scales: { x: { type: 'time', From 7dd9881943d5edfe58d3f0c078d2bd3f14ed5e0f Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 23 Dec 2023 10:05:24 +0000 Subject: [PATCH 2/3] No need for pytz --- build.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index 0bf02b2..a4f0ad3 100755 --- a/build.py +++ b/build.py @@ -7,10 +7,8 @@ import json import os import sys import typing -from collections import Counter -from datetime import date, datetime, timedelta +from datetime import datetime, timezone -import pytz import requests config = configparser.ConfigParser() @@ -70,7 +68,7 @@ def parse_date(date_str: str | None) -> datetime | None: return None fmt = "%Y-%m-%dT%H:%M:%SZ" if date_str.endswith("Z") else "%Y-%m-%dT%H:%M:%S%z" - return datetime.strptime(date_str, fmt).astimezone(pytz.utc) + return datetime.strptime(date_str, fmt).astimezone(timezone.utc) def count_open_bugs(bug_reports: list[Bug]) -> list[tuple[str, int]]: From 65693e2a8c87d435aea99bd2cd5e37b97f3344b7 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sat, 23 Dec 2023 10:07:19 +0000 Subject: [PATCH 3/3] Add README.md --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4c4b88f --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# README for Bug Chart + +## Overview +Bug Chart is a Python tool designed to visualize the number of open bugs over time in a Forgejo repository. It retrieves data from Forgejo's API and generates a line graph showing the trend of open bugs. This tool is particularly useful for project managers and developers who want to track bug trends in their software projects. + +## Features +- **Data Retrieval**: Downloads bug data from Forgejo using API tokens. +- **Graph Generation**: Creates an HTML file with a line graph representing open bugs over time. +- **Caching**: Stores bug data locally to reduce API calls. +- **Refresh Capability**: Can be manually refreshed to update the data and graph. + +## Requirements +- Python 3 +- Libraries: `requests`, `json`, `configparser` + +## Installation +Clone the repository from [https://git.4angle.com/edward/bug-chart](https://git.4angle.com/edward/bug-chart). Ensure you have Python 3 and the required libraries installed. + +## Configuration +Create a configuration file with the following structure: + +```ini +[forgejo] +hostname= +token= + +[output] +dest= +cache= +``` + +## Usage +Run `build.py` to generate the bug chart. The script can be scheduled to run periodically using cron. For example: + +```bash +40 9 * * * python3 ~/src/bug-chart/backup.py --refresh +``` + +To force a data refresh, run: + +```bash +python3 build.py --refresh +``` + +## Output +The script generates an HTML file (`chart.html`) displaying the line graph of open bugs over time. + +## License +This project is licensed under the MIT License. + +## Contact +For queries or contributions, please email Edward Betts at [edward@4angle.com](mailto:edward@4angle.com). + +## Acknowledgements +Developed and maintained by Edward Betts.