[O] Optimize code style

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