From ae859983107120bb2b865a18a819f3e0ff51abb5 Mon Sep 17 00:00:00 2001 From: Eric Pedley Date: Thu, 28 Jan 2021 10:07:23 -0800 Subject: [PATCH] fixed grade bug --- js/grades.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/grades.js b/js/grades.js index 0c8b086..c884d6d 100644 --- a/js/grades.js +++ b/js/grades.js @@ -173,7 +173,8 @@ var fetchQueue = []; throw new Error("Assignment details could not be read"); } - let pts = Number.parseFloat(json.section[0].period[0].assignment.filter(x => x.assignment_id == Number.parseInt(assignment.dataset.id.substr(2)))[0].max_points); + const assignments = json.section[0].period.reduce((prevVal,curVal)=> prevVal.concat(curVal.assignment),[]);//combines the assignment arrays from each period + let pts = Number.parseFloat(assignments.filter(x => x.assignment_id == assignment.dataset.id.substr(2))[0].max_points); if (!assignment.classList.contains("dropped")) { max += pts; Logger.log(`Max points for assignment ${assignment.dataset.id.substr(2)} is ${pts}`);