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({
257257 }
258258 data = { timeSeriesData }
259259 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 ]
261264 }
262265 // Get the trend from the last two COMPLETE periods
263266 trendFn = { ( data , key ) =>
Original file line number Diff line number Diff line change @@ -279,7 +279,10 @@ function UsersChartCard({
279279 queryKey = "usersChart"
280280 data = { timeSeriesData }
281281 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 ]
283286 }
284287 // Get the trend from the last two COMPLETE periods
285288 trendFn = { ( data , key ) =>
You can’t perform that action at this time.
0 commit comments