File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
apps/dashboard/src/app/team/[team_slug] Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,10 @@ function UsersChartCard({
257
257
}
258
258
data = { timeSeriesData }
259
259
aggregateFn = { ( _data , key ) =>
260
- timeSeriesData [ timeSeriesData . length - 2 ] ?. [ key ]
260
+ // If there is only one data point, use that one, otherwise use the previous
261
+ timeSeriesData . filter ( ( d ) => ( d [ key ] as number ) > 0 ) . length >= 2
262
+ ? timeSeriesData [ timeSeriesData . length - 2 ] ?. [ key ]
263
+ : timeSeriesData [ timeSeriesData . length - 1 ] ?. [ key ]
261
264
}
262
265
// Get the trend from the last two COMPLETE periods
263
266
trendFn = { ( data , key ) =>
Original file line number Diff line number Diff line change @@ -279,7 +279,10 @@ function UsersChartCard({
279
279
queryKey = "usersChart"
280
280
data = { timeSeriesData }
281
281
aggregateFn = { ( _data , key ) =>
282
- timeSeriesData [ timeSeriesData . length - 2 ] ?. [ key ]
282
+ // If there is only one data point, use that one, otherwise use the previous
283
+ timeSeriesData . filter ( ( d ) => ( d [ key ] as number ) > 0 ) . length >= 2
284
+ ? timeSeriesData [ timeSeriesData . length - 2 ] ?. [ key ]
285
+ : timeSeriesData [ timeSeriesData . length - 1 ] ?. [ key ]
283
286
}
284
287
// Get the trend from the last two COMPLETE periods
285
288
trendFn = { ( data , key ) =>
You can’t perform that action at this time.
0 commit comments