Skip to content

Commit afb92dc

Browse files
author
Suhas Hariharan
committed
fixed logic in extract percentage function
1 parent 36e0281 commit afb92dc

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/js/helpers.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function extractFinalPercent (html) {
150150
let current_string = html.match(/(?=document\.write).*/g)[1];
151151
current_string = /\[.*\]/g.exec(current_string)[0].slice(1, -1);
152152
const temp = current_string.split(";");
153-
number = Math.max(isNaN(temp[temp.length - 2]) || temp[temp.length - 2] ? parseFloat(temp[temp.length - 2]) : -Infinity, isNaN(temp[temp.length - 1]) || temp[temp.length - 1] ? parseFloat(temp[temp.length - 1]) : -Infinity);
153+
number = Math.max(isNaN(temp[temp.length - 2]) ? -Infinity : parseFloat(temp[temp.length - 2]), isNaN(temp[temp.length - 1]) ? -Infinity : parseFloat(temp[temp.length - 1]));
154154
} catch (e) {
155155
return;
156156
}
@@ -244,13 +244,12 @@ function assignmentsFromNode (node) {
244244

245245
/**
246246
* Return Assignment instances for the given class page.
247-
* @param {String} student_id student id for the current user
248-
* @param {String} sectino_id section id for the course being requested
249-
* @param {String} start_date start date in YYYY-MM-DD format
250-
* @param {String} end_date end date in YYYY-MM-DD format
247+
* @param {String} studentId student id for the current user
248+
* @param {String} sectionId section id for the course being requested
249+
* @param {String} currentSemester currentSemester the current semester (either S1 or S2)
251250
* @returns {Assignment[]} Assignments in this course
252251
*/
253-
function assignmentsFromAPI (studentId, sectionId, startDate, endDate) {
252+
function assignmentsFromAPI (studentId, sectionId, currentSemester) {
254253
const assignmentList = [];
255254
try {
256255
fetch('https://powerschool.sas.edu.sg/ws/xte/assignment/lookup', {
@@ -261,8 +260,7 @@ function assignmentsFromAPI (studentId, sectionId, startDate, endDate) {
261260
body: JSON.stringify({
262261
"student_ids": [studentId],
263262
"section_ids": [sectionId],
264-
"start_date": startDate,
265-
"end_date": endDate,
263+
"store_codes": [currentSemester],
266264
}),
267265
credentials: "same-origin",
268266
}).then(response => response.json()).then(response => {

0 commit comments

Comments
 (0)