Flow
Before days become weeks
One question per step, in the order the post covers them.
1What kind of number is it?
A count, a level like open pull requests, or a rate made of two counts.
2Counts get added
A week's total is the sum of its days.
3Levels get a named rule
An average or the last reading, and the chart says which.
4Rates get rebuilt
Add up the top count and the bottom count for the week, then divide once.
5Where does a week start, and is it whole?
One shared Monday rule, and a note on edge weeks with only a few days.
The agent dashboard now shows one point per week for long time ranges, and the weekly review resolution rate is an average of daily percentages. That's wrong. I found it reading back the change that added weekly points.
When you look back more than about a month, the dashboard groups days into weeks. The database does this for the cost and token charts. A small helper in the server code does it for the review and pull-request charts, and each chart hands it a function that says how to squash a week of days into one value.
Counts, levels and rates need different math
Counts, like reviews written or money spent, get added up. My helper does that.
Levels, like how many pull requests are open right now, can't be added, or one pull request open all week gets counted seven times. My helper averages them, which is okay if the chart says it's an average.
Rates are where it broke. My helper averages each day's rate. But a day with one review gets the same say as a day with forty. If one review on Monday was resolved and nine on Tuesday weren't, the average says fifty percent when the real answer is ten. Keep the two counts, resolved and total, add each up for the week, and divide once. Skip days with no reviews, which my helper already does right.
The database side of the same change does rates correctly, because it adds up the counts first and divides at the end.
Two different Mondays
The database starts each week on Monday in the viewer's timezone. My helper works out Monday using the server's timezone and then writes the date in UTC. If the server runs behind UTC, I think the two would disagree about which week a Monday belongs to. I haven't checked the server's setting. One shared function for the week start removes the question.
Short weeks look like slow weeks
If your range starts on a Thursday, the first week only has a few days in it. Added-up numbers in that week look low for no real reason. Mark those edge weeks or say how many days they cover.
Arrows that measure something else
My cards compare the first half of the chart with the second half, but the card says the change is from the previous period. The small line on the card uses a different rule for its color, so the two can point different ways.
A setting that stopped firing
The charts thin out long lines past a bit over two months of points. A quarter of weekly points is about thirteen, so on the weekly view the thinning simply never runs anymore.