From 92e692f69aed8425b4c3d17e5b3f02576d3a3cca Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 6 Nov 2019 18:27:19 -0500 Subject: [PATCH] [O] Remove getGradedCourses --- src/components/app/app.ts | 2 +- src/utils/course-utils.ts | 33 --------------------------------- src/utils/gpa-utils.ts | 5 +++-- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/components/app/app.ts b/src/components/app/app.ts index d254109..64955db 100644 --- a/src/components/app/app.ts +++ b/src/components/app/app.ts @@ -158,7 +158,7 @@ export default class App extends Vue pWaitFor(() => this.courses.every(c => c.assignments != null)).then(() => { // Filter courses - this.filteredCourses = CourseUtils.getGradedCourses(this.courses); + this.filteredCourses = this.courses.filter(c => c.isGraded); // Check grading algorithms this.checkGradingAlgorithms(); diff --git a/src/utils/course-utils.ts b/src/utils/course-utils.ts index b8eb49e..9ea4b14 100644 --- a/src/utils/course-utils.ts +++ b/src/utils/course-utils.ts @@ -19,39 +19,6 @@ UNKNOWN_COURSE_LIST.set('Painting', LEVEL_CP); export class CourseUtils { - /** - * Return a list of courses that are graphed - * - * @param original Original course list - * @return Course[] Filtered course list - */ - public static getGradedCourses(original: Course[]): Course[] - { - // Define result - let result: Course[] = []; - - // Filter through courses - original.forEach(course => - { - // Skip future or past courses - if (course.status != 'active') return; - - // Skip courses without levels TODO: Ask for user input - if (course.level == 'None' || course.level == 'Unknown' || course.scaleUp == -1) return; - - // Skip courses without graded assignments - if (course.assignments.filter(a => a.complete == 'Complete').length == 0) return; - - // Skip if there are no grading scale - // if (course.grading.method == 'NOT_GRADED') return; - - // Add it to the list - result.push(course); - }); - - return result; - } - /** * Format course to tab index string * diff --git a/src/utils/gpa-utils.ts b/src/utils/gpa-utils.ts index 993845f..b7a7d60 100644 --- a/src/utils/gpa-utils.ts +++ b/src/utils/gpa-utils.ts @@ -1,8 +1,9 @@ + +import Course from '@/logic/course'; + /** * This is an utility class to calculate GPA. */ -import {Course} from '@/components/app/app'; - export class GPAUtils { // [[Min score, Letter grade, Base GPA], ...]