[F] Fix weight errors when the calculated grade equals the supposed grade

This commit is contained in:
Hykilpikonna
2019-11-12 17:23:14 -05:00
parent c97a202bd5
commit cdf5475c3b
+10 -20
View File
@@ -152,28 +152,18 @@ export default class App extends Vue
// Loop through all the courses
for (const course of this.filteredCourses)
{
let termGrade = +GPAUtils.getTotalMeanAverage(course.computed.termAssignments[Constants.CURRENT_TERM]).toFixed(2);
// Check if total-average grade is the same with percent-type grade
if (course.rawNumericGrade == termGrade)
// Request grading scheme for this course
App.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
{
course.grading = {method: 'TOTAL_MEAN', weightingMap: {}};
}
else
{
// Request grading scheme for this course
App.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
// Check success
if (response.success)
{
// Check success
if (response.success)
{
// Add it to course
course.grading = response.data;
}
else throw new Error(response.data);
})
.catch(e => this.showError(`Error: Grading data failed to load.\n(${e})`))
}
// Add it to course
course.grading = response.data;
}
else throw new Error(response.data);
})
.catch(e => this.showError(`Error: Grading data failed to load.\n(${e})`))
}
// Wait for done