61 lines
2.8 KiB
Markdown
61 lines
2.8 KiB
Markdown
# PR#57: the dashboard counts pull requests per period and shows their trend
|
|
|
|
> **WARNING:** This document describes only the change applied in this PR.
|
|
> It may already be outdated once the next PR is merged.
|
|
> Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.
|
|
|
|
## The Problem
|
|
|
|
The tables per day, week and month of the dashboard count reviews.
|
|
Since a pull request gets several reviews, e.g. one per commit, the cost per pull request says more than the cost per review,
|
|
and the user asked for it on 2026-10-08.
|
|
The tables also show no trend: one has to compare the rows by eye.
|
|
|
|
## Non-Goals
|
|
|
|
- No change of the statistics API: it reports the pull requests and the cost per pull request per period already.
|
|
- No chart library: the dashboard stays one file without dependencies.
|
|
|
|
## The Scenarios
|
|
|
|
### Feature: the dashboard counts pull requests per period and shows their trend
|
|
|
|
#### Scenario#57.01: the tables per period show pull requests and the cost per pull request
|
|
|
|
So that a reader sees what a pull request costs, whatever number of reviews it needed.
|
|
|
|
- **Given** the statistics of a period
|
|
- **When** the dashboard shows the table per day, week or month
|
|
- **Then** each row shows the cost, the number of pull requests and the cost per pull request
|
|
|
|
##### Verified by
|
|
|
|
- [UsageApiIntegrationTest: the tables per period show pull requests and the cost per pull request](../../statistics/src/test/kotlin/de/hoennig/werkrevisor/statistics/UsageApiIntegrationTest.kt)
|
|
|
|
#### Scenario#57.02: a trend chart stands between the heading and the table of each period
|
|
|
|
So that a reader sees at a glance how the cost and the number of pull requests develop.
|
|
|
|
- **When** the dashboard shows the days, weeks or months
|
|
- **Then** a chart between the heading and the table shows the dates on the x axis
|
|
- **and** bars for the cost per period, a line for the cost per pull request and a line for the number of pull requests
|
|
- **and** each of the three has its own y axis
|
|
|
|
##### Verified by
|
|
|
|
- [UsageApiIntegrationTest: a trend chart stands between the heading and the table of each period](../../statistics/src/test/kotlin/de/hoennig/werkrevisor/statistics/UsageApiIntegrationTest.kt)
|
|
|
|
## The Solution
|
|
|
|
- werkrevisor-dashboard.js: the tables per period show "PRs" and "Per PR" instead of "Reviews";
|
|
the small bar per row is gone, since the chart shows the trend and the tables now fit side by side.
|
|
- An inline SVG chart per period, drawn by the dashboard itself, with a tooltip per date;
|
|
it starts at the oldest period with reviews or costs, so that empty months do not squeeze the data to the right edge.
|
|
- A local preview with a copy of the statistics of 2026-10-08 showed the charts and the tables at 1280 px width.
|
|
- docs/werkrevisor.werkbaum marks both dashboard nodes as done.
|
|
- werkrevisor 0.27.1.
|
|
|
|
## Prerequisite PRs
|
|
|
|
- PR#56: werkrevisor 0.27.0, merged.
|