Commit 66c4972
authored
🐛 Fixed Analytics > Growth MRR chart starting at zero at beginning of time range (#25694)
ref
https://linear.app/ghost/issue/NY-328/investigate-mrr-chart-showing-zero-for-blueshirt-banter
## Problem
In some cases, the MRR chart in Analytics > Growth will incorrectly
start at $0 for the very first data point.
<img width="1428" height="496" alt="Screenshot 2025-12-10 at 21 44
47@2x"
src="https://github.com/user-attachments/assets/f53a6abc-6f51-4abe-872f-694ca1efa7c7"
/>
## Cause
The `/stats/mrr` endpoint returns a sparse dataset, only including dates
in the response that had changes in MRR, so not every data point in the
chart is returned by the API. The frontend logic for calculating the
first data point was not accounting for this, and defaulting to $0.
## Fix
The fix is to check for this condition where there are missing data
points between the `dateFrom` parameter passed to the API (the first day
of the selected date range) and the first data point returned by the
API, and to fill in the earliest MRR value for this range.1 parent 8e89eb7 commit 66c4972
File tree
2 files changed
+50
-0
lines changed- apps/stats
- src/hooks
- test/unit/hooks
2 files changed
+50
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
299 | 307 | | |
300 | 308 | | |
301 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
282 | 324 | | |
283 | 325 | | |
284 | 326 | | |
| |||
0 commit comments