[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 // Loop through all the courses
for (const course of this.filteredCourses) for (const course of this.filteredCourses)
{ {
let termGrade = +GPAUtils.getTotalMeanAverage(course.computed.termAssignments[Constants.CURRENT_TERM]).toFixed(2); // Request grading scheme for this course
App.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
// Check if total-average grade is the same with percent-type grade
if (course.rawNumericGrade == termGrade)
{ {
course.grading = {method: 'TOTAL_MEAN', weightingMap: {}}; // Check success
} if (response.success)
else
{
// Request grading scheme for this course
App.http.post('/grading', {'assignmentsId': course.assignmentsId}).then(response =>
{ {
// Check success // Add it to course
if (response.success) course.grading = response.data;
{ }
// Add it to course else throw new Error(response.data);
course.grading = response.data; })
} .catch(e => this.showError(`Error: Grading data failed to load.\n(${e})`))
else throw new Error(response.data);
})
.catch(e => this.showError(`Error: Grading data failed to load.\n(${e})`))
}
} }
// Wait for done // Wait for done