File tree 1 file changed +15
-0
lines changed
static/gsApp/views/subscriptionPage
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,8 @@ export function mapReservedBudgetStatsToChart({
361
361
return chartData ;
362
362
}
363
363
364
+ let previousReservedForDate = 0 ;
365
+ let previousOnDemandForDate = 0 ;
364
366
Object . entries ( statsByDateAndCategory ) . forEach ( ( [ date , statsByCategory ] ) => {
365
367
let reservedForDate = 0 ;
366
368
let onDemandForDate = 0 ;
@@ -408,13 +410,26 @@ export function mapReservedBudgetStatsToChart({
408
410
}
409
411
} ) ;
410
412
} ) ;
413
+ // if cumulative and there was no new spend on this date, use the previous date's spend
414
+ if (
415
+ reservedForDate === 0 &&
416
+ isCumulative &&
417
+ moment ( date ) . isSameOrBefore ( moment ( ) . toDate ( ) )
418
+ ) {
419
+ reservedForDate = previousReservedForDate ;
420
+ }
421
+ if ( onDemandForDate === 0 && isCumulative ) {
422
+ onDemandForDate = previousOnDemandForDate ;
423
+ }
411
424
const dateKey = getDateFromMoment ( moment ( date ) ) ;
412
425
chartData . reserved ! . push ( {
413
426
value : [ dateKey , reservedForDate ] ,
414
427
} ) ;
428
+ previousReservedForDate = reservedForDate ;
415
429
chartData . onDemand ! . push ( {
416
430
value : [ dateKey , onDemandForDate ] ,
417
431
} ) ;
432
+ previousOnDemandForDate = onDemandForDate ;
418
433
} ) ;
419
434
420
435
return chartData ;
You can’t perform that action at this time.
0 commit comments