Skip to content

Commit c992154

Browse files
author
Suhas Hariharan
committed
fixed table reading
Signed-off-by: Suhas Hariharan <[email protected]>
1 parent cde033b commit c992154

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/js/components/CategoryWeighting.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ export default {
140140
methods: {
141141
async getCatmap () {
142142
let catmap = await getSavedCategoryWeighting();
143-
if (catmap === false) {
144-
catmap = {};
145-
this.categories.sort();
146-
this.categories.forEach((e, i) => {
143+
catmap = {};
144+
this.categories.sort();
145+
this.categories.forEach((e, i) => {
146+
if (catmap[e] === undefined) {
147147
catmap[e] = { weighting: 0, category: e };
148-
});
149-
}
148+
}
149+
});
150150
const category_set = new Set(this.categories);
151151
for (var cat in catmap) {
152152
category_set.add(cat);

src/js/helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ function extractAssignmentList() {
206206
const assignments = [];
207207
[...table.querySelectorAll('tr')].slice(1, -1).forEach((e, i) => {
208208
const curr = e.querySelectorAll('td');
209-
assignments.push(new ClassAssignment(i, curr[0].innerHTML, curr[1].innerText, curr[2].innerHTML, isIndicatorPresent(curr[4]), isIndicatorPresent(curr[5]), isIndicatorPresent(curr[6]), isIndicatorPresent(curr[7]), isIndicatorPresent(curr[8]), curr[11].innerHTML, curr[12].innerHTML.trim()));
209+
let offset = 0;
210+
if (curr.length === 14) {
211+
offset = 1;
212+
}
213+
assignments.push(new ClassAssignment(i, curr[0].innerHTML, curr[1].innerText, curr[2].innerHTML, isIndicatorPresent(curr[3 + offset]), isIndicatorPresent(curr[4 + offset]), isIndicatorPresent(curr[5 + offset]), isIndicatorPresent(curr[6 + offset]), isIndicatorPresent(curr[7 + offset]), curr[10 + offset].innerText, curr[11 + offset].innerText.trim()));
210214
});
211215
return assignments;
212216
}

src/js/saspowerschoolff.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ function addHypoGradeCalc (courses) {
439439
async function addVueGrades () {
440440
const assignments = extractAssignmentList();
441441
const cat = extractGradeCategories(document.querySelector("table.zebra.grid > tbody"));
442+
console.log(assignments);
442443
gt = new (Vue.extend(GradeTable))({ // remake grade table to easily read grades
443444
propsData: {
444445
categories: cat,

0 commit comments

Comments
 (0)