diff --git a/README.md b/README.md index 877e286..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 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 @@ class BurndownChart: 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)))