Skip to content

Commit

Permalink
Merge pull request #24 from jhale1805/dev
Browse files Browse the repository at this point in the history
Simplify Makefile commands + add optional `chart_end_date` setting
  • Loading branch information
thehale authored Nov 2, 2021
2 parents efd02e8 + fab7d61 commit fec7813
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`. <br/><br/> Must be entered here since GitHub Project Boards don't have an assigned start/end date. <br/><br/> Example: `2021-10-08` |
| `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` |
| `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` |
| `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) |

#### Organization Projects
Expand All @@ -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.
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/github_projects_burndown_chart/chart/burndown.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

Expand Down

0 comments on commit fec7813

Please sign in to comment.