web/satellite: only fill charts with zero if day is complete
Before this change we would fill all days on the chart with zero if no data existed. This led to concerns when users saw their stored data value drop to zero. Instead, we will leave incomplete days blank if there is no usage data. This includes today and future days. issue: https://github.com/storj/customer-issues/issues/1157 Change-Id: I4b9def392b89684fe63f1503274e868a240eb353
This commit is contained in:
parent
dcc3245954
commit
26b6ab8a3a
@ -26,6 +26,9 @@ export class ChartUtils {
|
||||
// Create new array of objects with date and corresponding data value with length of date range difference.
|
||||
const chartData: DataStamp[] = new Array(datesArr.length);
|
||||
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
// Fill new array.
|
||||
for (let i = 0; i < datesArr.length; i++) {
|
||||
// Find in fetched data a day-data value that corresponds to current iterable date.
|
||||
@ -36,8 +39,10 @@ export class ChartUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If not found then fill new array with day and zero data value.
|
||||
chartData[i] = DataStamp.emptyWithDate(datesArr[i]);
|
||||
// If not found and day has passed then fill new array with day and zero data value.
|
||||
if (datesArr[i].getTime() < today.getTime()) {
|
||||
chartData[i] = DataStamp.emptyWithDate(datesArr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return chartData;
|
||||
|
Loading…
Reference in New Issue
Block a user