diff --git a/Makefile b/Makefile index c024074..72a4f6a 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ build: instructions run: instructions cd ./src/github_projects_burndown_chart \ - && PYTHONPATH=. python main.py $(project_type) $(project_name) + && PYTHONPATH=. python main.py $(type) $(name) test: instructions coverage run \ diff --git a/README.md b/README.md index db209d2..3ebc65d 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ This allows the `.gitignore` to exclude your `config.json` from being accidental |----------|---------| | `sprint_start_date` | The first day of the sprint formatted as `YYYY-MM-DD`.

Must be entered here since GitHub Project Boards don't have an assigned start/end date.

Example: `2021-10-08` | | `sprint_end_date` | The last day of the sprint formatted as `YYYY-MM-DD`.

Must be entered here since GitHub Project Boards don't have an assigned start/end date.

Example: `2021-10-21` | +| `chart_end_date` | (OPTIONAL) The last day to show on the burndown chart formatted as `YYYY-MM-DD`.

Used to change the end date of the chart without affecting the slope of the ideal burndown line (e.g. to show tasks that were completed after the official end of a sprint).

Example: `2021-10-24` | | `points_label` | (OPTIONAL) The prefix for issue labels containing the point value of the issue. Removing this prefix must leave just an integer. If set to `null`, the burndown chart will count open issues instead of points.

Example: `Points: ` (with the space) | #### Organization Projects @@ -100,7 +101,7 @@ All settings are the same as for the [Repository Projects](#repository-projects) ## Usage Given that `PROJECT_TYPE` is one of `[repository, organization]` and `PROJECT_NAME` matches a key in the `config.json` under the chosen `PROJECT_TYPE`, run the following command: ``` -make run project_type=PROJECT_TYPE project_name=PROJECT_NAME +make run type=PROJECT_TYPE name=PROJECT_NAME ``` This will pop up an interactive window containing the burndown chart, including a button for saving it as a picture. @@ -110,12 +111,12 @@ Make a copy of `example.config.json` without the leading `example.` To see this repository's example project board: ``` -make run project_type=repository project_name=burndown_chart_kickoff +make run type=repository name=burndown_chart_kickoff ``` To see Golang's progress on their current roadmap: ``` -make run project_type=organization project_name=golang_on_deck +make run type=organization name=golang_on_deck ``` ## Contributing diff --git a/src/github_projects_burndown_chart/chart/burndown.py b/src/github_projects_burndown_chart/chart/burndown.py index e1e6101..414c193 100644 --- a/src/github_projects_burndown_chart/chart/burndown.py +++ b/src/github_projects_burndown_chart/chart/burndown.py @@ -13,21 +13,26 @@ def __init__(self, project: Project): config['settings']['sprint_start_date']) self.end_date_utc: datetime = parse_to_utc( config['settings']['sprint_end_date']) + self.chart_end_date_utc: datetime = parse_to_utc( + config['settings']['chart_end_date']) \ + if config['settings'].get('chart_end_date') else None self.project: Project = project def render(self): + end_date = self.chart_end_date_utc if self.chart_end_date_utc else self.end_date_utc outstanding_points_by_day = self.project.outstanding_points_by_date( self.start_date_utc, - self.end_date_utc) + end_date) # Load date dict for priority values with x being range of how many days are in sprint x = list(range(len(outstanding_points_by_day.keys()))) y = list(outstanding_points_by_day.values()) + sprint_days = (self.end_date_utc - self.start_date_utc).days # Plot point values for sprint along xaxis=range yaxis=points over time plt.plot(x, y) plt.axline((x[0], self.project.total_points), - slope=-(self.project.total_points/(len(y)-1)), + slope=-(self.project.total_points/(sprint_days)), color="green", linestyle=(0, (5, 5)))