Skip to content

Commit

Permalink
fixed table reading
Browse files Browse the repository at this point in the history
Signed-off-by: Suhas Hariharan <hariharan774531@sas.edu.sg>
  • Loading branch information
Suhas Hariharan committed Nov 3, 2021
1 parent cde033b commit c992154
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/js/components/CategoryWeighting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ export default {
methods: {
async getCatmap () {
let catmap = await getSavedCategoryWeighting();
if (catmap === false) {
catmap = {};
this.categories.sort();
this.categories.forEach((e, i) => {
catmap = {};
this.categories.sort();
this.categories.forEach((e, i) => {
if (catmap[e] === undefined) {
catmap[e] = { weighting: 0, category: e };
});
}
}
});
const category_set = new Set(this.categories);
for (var cat in catmap) {
category_set.add(cat);
Expand Down
6 changes: 5 additions & 1 deletion src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ function extractAssignmentList() {
const assignments = [];
[...table.querySelectorAll('tr')].slice(1, -1).forEach((e, i) => {
const curr = e.querySelectorAll('td');
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()));
let offset = 0;
if (curr.length === 14) {
offset = 1;
}
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()));
});
return assignments;
}
Expand Down
1 change: 1 addition & 0 deletions src/js/saspowerschoolff.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ function addHypoGradeCalc (courses) {
async function addVueGrades () {
const assignments = extractAssignmentList();
const cat = extractGradeCategories(document.querySelector("table.zebra.grid > tbody"));
console.log(assignments);
gt = new (Vue.extend(GradeTable))({ // remake grade table to easily read grades
propsData: {
categories: cat,
Expand Down

0 comments on commit c992154

Please sign in to comment.