Skip to content

Commit fab7d61

Browse files
committed
Add optional chart_end_date setting
This new setting allows you to change the end date of the chart without affecting the slope of the ideal burndown line. This is useful for showing tasks that were completed after the official end of a sprint.
1 parent 21805e7 commit fab7d61

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ This allows the `.gitignore` to exclude your `config.json` from being accidental
8888
|----------|---------|
8989
| `sprint_start_date` | The first day of the sprint formatted as `YYYY-MM-DD`. <br/><br/> Must be entered here since GitHub Project Boards don't have an assigned start/end date. <br/><br/> Example: `2021-10-08` |
9090
| `sprint_end_date` | The last day of the sprint formatted as `YYYY-MM-DD`. <br/><br/> Must be entered here since GitHub Project Boards don't have an assigned start/end date. <br/><br/> Example: `2021-10-21` |
91+
| `chart_end_date` | (OPTIONAL) The last day to show on the burndown chart formatted as `YYYY-MM-DD`. <br/><br/> 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). <br/><br/> Example: `2021-10-24` |
9192
| `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.<br/><br/> Example: `Points: ` (with the space) |
9293

9394
#### Organization Projects

src/github_projects_burndown_chart/chart/burndown.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,26 @@ def __init__(self, project: Project):
1313
config['settings']['sprint_start_date'])
1414
self.end_date_utc: datetime = parse_to_utc(
1515
config['settings']['sprint_end_date'])
16+
self.chart_end_date_utc: datetime = parse_to_utc(
17+
config['settings']['chart_end_date']) \
18+
if config['settings'].get('chart_end_date') else None
1619

1720
self.project: Project = project
1821

1922
def render(self):
23+
end_date = self.chart_end_date_utc if self.chart_end_date_utc else self.end_date_utc
2024
outstanding_points_by_day = self.project.outstanding_points_by_date(
2125
self.start_date_utc,
22-
self.end_date_utc)
26+
end_date)
2327
# Load date dict for priority values with x being range of how many days are in sprint
2428
x = list(range(len(outstanding_points_by_day.keys())))
2529
y = list(outstanding_points_by_day.values())
30+
sprint_days = (self.end_date_utc - self.start_date_utc).days
2631

2732
# Plot point values for sprint along xaxis=range yaxis=points over time
2833
plt.plot(x, y)
2934
plt.axline((x[0], self.project.total_points),
30-
slope=-(self.project.total_points/(len(y)-1)),
35+
slope=-(self.project.total_points/(sprint_days)),
3136
color="green",
3237
linestyle=(0, (5, 5)))
3338

0 commit comments

Comments
 (0)