From 9026b9d3a9ea99d4c9b4e3670b6a65d66c9a73f7 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 9 Nov 2019 17:02:53 -0500 Subject: [PATCH] [-] Remove deprecated convertChart() --- .../overall/overall-line/overall-line.ts | 115 ------------------ .../overall/overall-line/overall-line.vue | 2 +- 2 files changed, 1 insertion(+), 116 deletions(-) diff --git a/src/pages/overall/overall-line/overall-line.ts b/src/pages/overall/overall-line/overall-line.ts index f4a194b..546a197 100644 --- a/src/pages/overall/overall-line/overall-line.ts +++ b/src/pages/overall/overall-line/overall-line.ts @@ -64,119 +64,4 @@ export default class OverallLine extends Vue max: (value: any) => Math.min(value.max, 110) } }; - - /** - * Convert assignments list to a graph dataset. - */ - get convertChart() - { - let courses = this.courses.filter(c => c.assignments.length > 0); - - // Compute the column names - let columns = courses.map(course => course.name); - columns.unshift('date'); - - // Find the min date - let minDates = courses.map(course => course.assignments[course.assignments.length - 1].date.getTime()); - let minDate: Date = new Date(Math.min.apply(null, minDates)); - - // Find the dates in between - let now = new Date(Math.min(new Date().getTime(), CourseUtils.getTermEndDate().getTime())); - let dates = []; - for (let date = minDate; date <= now; date.setDate(date.getDate() + 1)) - { - dates.push(new Date(date)); - } - - // Compute the rows data - let rows: {[index: string]: any}[] = []; - dates.forEach(date => - { - // Define row object - let row: {[index: string]:any} = {'date': date.getTime()}; - - // Loop through courses - courses.forEach(course => - { - // Total Mean - if (course.grading.method == 'TOTAL_MEAN') - { - let score = 0; - let max = 0; - - // Loop through assignments - course.assignments.forEach(assignment => - { - // If assignment should be displayed - if (assignment.complete != 'Complete') return; - - // Date is being looked at - if (assignment.date.getTime() < date.getTime()) - { - // Record scores - score += assignment.score; - max += assignment.scoreMax; - } - }); - - // Add average to the row - row[course.name] = score / max * 100; - } - else if (course.grading.method == 'PERCENT_TYPE') - { - let typeScores: {[index: string]: any} = {}; - let typeCounts: {[index: string]: any} = {}; - - // Loop through assignments - course.assignments.forEach(assignment => - { - // If assignment should be displayed - if (assignment.complete != 'Complete') return; - - // Date is being looked at - if (assignment.date.getTime() < date.getTime()) - { - // Record scores - if (typeScores[assignment.type] == undefined) typeScores[assignment.type] = 0; - typeScores[assignment.type] += assignment.score / assignment.scoreMax; - - if (typeCounts[assignment.type] == undefined) typeCounts[assignment.type] = 0; - typeCounts[assignment.type] ++; - } - }); - - // Count total percentage (This is to avoid less than expected cases) - // Eg. If HW = 25% and Quiz = 75%, I have 1 hw and 0 quiz - // Without total percentage, the avg grade I get is 25%. - let totalPercentage = 0; - for (let type in course.grading.weightingMap) - { - if (typeScores[type] != undefined) - { - totalPercentage += course.grading.weightingMap[type]; - } - } - - // Count - let score = 0; - for (let type in typeScores) - { - let typeFactor = course.grading.weightingMap[type] / totalPercentage; - score += typeScores[type] * typeFactor / typeCounts[type]; - } - - // Add average to the row - if (score != 0) row[course.name] = score * 100; - } - }); - - // Add it to the array - rows.push(row); - }); - - return { - columns: columns, - rows: rows - } - } } diff --git a/src/pages/overall/overall-line/overall-line.vue b/src/pages/overall/overall-line/overall-line.vue index a184eb9..e884bb9 100644 --- a/src/pages/overall/overall-line/overall-line.vue +++ b/src/pages/overall/overall-line/overall-line.vue @@ -1,6 +1,6 @@