[F] Fix multiple assignment creating multiple dates issue
This commit is contained in:
@@ -79,22 +79,26 @@ export default class OverallLine extends Vue
|
|||||||
*/
|
*/
|
||||||
private getCourseSeries(course: Course)
|
private getCourseSeries(course: Course)
|
||||||
{
|
{
|
||||||
|
// Graded assignments
|
||||||
|
let assignments = course.gradedAssignments.slice().reverse();
|
||||||
|
|
||||||
|
// Create series
|
||||||
return {
|
return {
|
||||||
name: course.name,
|
name: course.name,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
data: course.gradedAssignments.slice().reverse().map((assignment, i, array) =>
|
data: this.toDateRange([...assignments.map(a => a.time)].map((time, i) =>
|
||||||
{
|
{
|
||||||
// Find subset before this assignment
|
// Find subset before this assignment
|
||||||
let subset = array.filter(a => a.time <= assignment.time);
|
let subset = assignments.filter(a => a.time <= time);
|
||||||
console.log(subset);
|
console.log(subset);
|
||||||
|
|
||||||
// Find grade
|
// Find grade
|
||||||
if (course.grading.method == 'PERCENT_TYPE')
|
if (course.grading.method == 'PERCENT_TYPE')
|
||||||
return [assignment.time, GPAUtils.getPercentTypeAverage(course, subset)];
|
return [time, GPAUtils.getPercentTypeAverage(course, subset)];
|
||||||
if (course.grading.method == 'TOTAL_MEAN')
|
if (course.grading.method == 'TOTAL_MEAN')
|
||||||
return [assignment.time, GPAUtils.getTotalMeanAverage(subset)];
|
return [time, GPAUtils.getTotalMeanAverage(subset)];
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user