diff --git a/package.json b/package.json index 1e91bcd..427eb1e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "saspes", "private": true, - "version": "2.0.0", + "version": "2.0.1", "description": "SAS Powerschool Enhancement Suite", "type": "module", "scripts": { diff --git a/src/content_script/guardianHome/index.ts b/src/content_script/guardianHome/index.ts index 29fd073..75b67e8 100644 --- a/src/content_script/guardianHome/index.ts +++ b/src/content_script/guardianHome/index.ts @@ -32,28 +32,37 @@ const classManager = new ClassManager([]); const rows = document.querySelectorAll(".linkDescList.grid > tbody > tr.center:not(.th2)"); - +console.log("Found rows", rows); for (const row of rows) { const nameEle = row.querySelector("td:nth-child(2)"); const s1GradeEle = row.querySelector("td:nth-child(3) > a") as HTMLAnchorElement; const s2GradeEle = row.querySelector("td:nth-child(4) > a"); + console.log("cur", row, nameEle, s1GradeEle, s2GradeEle); - - if (!nameEle || !s1GradeEle || !s2GradeEle) continue; + if (!nameEle || !(s1GradeEle || s2GradeEle)) { + console.log("Missing element on ", row, nameEle, s1GradeEle, s2GradeEle); + continue; + } const name = nameEle.firstChild?.textContent?.trim(); - if (!name) continue; + if (!name) { + console.log("No name on ", nameEle, row); + continue; + }; + + let s1Grade: string | null = s1GradeEle?.textContent?.trim()!; - let s1Grade: string | null = s1GradeEle.textContent?.trim()!; - if (!s1Grade) continue; if (!listOfGrades.includes(s1Grade as Grade)) s1Grade = null; - let s2Grade: string | null = s2GradeEle.textContent?.trim()!; - if (!s2Grade) continue; + let s2Grade: string | null = s2GradeEle?.textContent?.trim()!; + if (!listOfGrades.includes(s2Grade as Grade)) s2Grade = null; - if (!s1Grade && !s2Grade) continue; + if (!s1Grade && !s2Grade) { + console.log("No grades on ", nameEle, row); + continue; + }; if (s1Grade !== null && s1Grade !== "INC" && s1GradeEle.href !== null) { const url = new URL(s1GradeEle.href); @@ -69,6 +78,8 @@ for (const row of rows) { if (f !== null) s1GradeEle.innerHTML += ` (${f.toFixed(2)})`; }) + } else { + console.log("Not finding final percent for ", nameEle, row); } classManager.addClass(new Class(name, { s1: s1Grade as Grade | null, s2: s2Grade as Grade | null }))