[O] Optimize in-between dates storing

This commit is contained in:
Hykilpikonna
2019-12-07 14:39:12 -05:00
parent 6d3e145558
commit 844eeefb4c
@@ -142,21 +142,21 @@ export default class OverallLine extends Vue
// Find the dates in between
let now = new Date(Math.min(new Date().getTime(), CourseUtils.getTermEndDate().getTime()));
let dates: number[] = [];
let times: number[] = [];
for (let date = minDate; date <= now; date.setDate(date.getDate() + 1))
{
dates.push(new Date(date).getTime());
times.push(date.getTime());
}
let lastValue: any = null;
return dates.map(date =>
return times.map(time =>
{
// Data point on this specific date
let thisValue = data.find(a => a[0] == date);
let thisValue = data.find(a => a[0] == time);
// None
if (thisValue == null) return [date, lastValue == null ? null : lastValue[1]];
else return [date, (lastValue = thisValue)[1]];
if (thisValue == null) return [time, lastValue == null ? null : lastValue[1]];
else return [time, (lastValue = thisValue)[1]];
});
}
}