Skip to content

Commit

Permalink
fixed reactivity of categories
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 Oct 13, 2021
1 parent 2829497 commit 1445977
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/js/components/CategoryWeighting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,13 @@ export default {
catmap[e] = { weighting: 0, category: e };
});
}
let category_set = new Set(this.categories);
for (var cat in catmap) {
category_set.add(cat);
this.renderWeights.push(catmap[cat]);
}
this.categories = Array.from(category_set);
this.gradetable.updateCategories(this.categories);
},
saveCategoryWeightingLocal () {
saveCategoryWeighting(this.getCategoryMap());
Expand All @@ -174,7 +178,7 @@ export default {
},
changeCategory (c, nc) {
this.gradetable.changeCategory(this.categories[c], nc);
this.categories[c] = nc;
this.$set(this.categories, c, nc);
},
},
};
Expand Down
3 changes: 3 additions & 0 deletions src/js/components/GradeTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ export default {
}
}
},
updateCategories (categories) {
this.categories = categories;
},
changeCategory (oc, nc) {
for (var i = 0; i < this.assignments.length; i++) {
if (this.assignments[i].category === oc) {
Expand Down
1 change: 1 addition & 0 deletions src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ function getDefaultConfig () {
return data;
}


export {
gradeToFP,
grade_fp,
Expand Down
2 changes: 1 addition & 1 deletion src/js/saspowerschoolff.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function addHypoGradeCalc (courses) {
/**
* Add a category weighting widget.
*/
function addVueGrades () {
async function addVueGrades () {
const assignments = extractAssignmentList();
const cat = extractGradeCategories(document.querySelector("#content-main > div.box-round > table:nth-child(4) > tbody"));
gt = new (Vue.extend(GradeTable))({ // remake grade table to easily read grades
Expand Down

0 comments on commit 1445977

Please sign in to comment.