diff --git a/src/js/__tests__/parsers.js b/src/js/__tests__/parsers.js index 4b94ddaf..8d85618e 100644 --- a/src/js/__tests__/parsers.js +++ b/src/js/__tests__/parsers.js @@ -2,6 +2,8 @@ * * @copyright Copyright (c) 2019-2020 Gary Kim * + * @copyright Copyright (c) 2021 Suhas Hariharan + * * @author Gary Kim * * @license GNU AGPL version 3 only @@ -190,84 +192,85 @@ test('Grade to Final Percent', t => { test('Extract Final Percent from Class Page', t => { const test_cases = [ { - i: "\n" + - " \tFinal\n" + - " Letter Grade1:A\n" + - " \n" + - "\t\t\t\t\n" + - " ", - o: 81.25, - }, - { - i: "\n" + - " \n" + - " \n" + - " \t\n" + - " \n" + - "\t\t\t\t\n" + - "
Final\n" + - " Letter Grade1:_
", + + i: ` + + Final + Letter Grade1: + A + + + `, + o: 82.5, + }, + { + i: ` + Final + Letter Grade1:A + + + `, o: undefined, }, { - i: "\n" + - " \tFinal\n" + - " Letter Grade1:A\n" + - " \n" + - "\t\t\t\t\n" + - " ", - o: 75, + i: ` + Final + Letter Grade1:A+ + + + `, + o: 90, }, ]; diff --git a/src/js/components/CategoryWeighting.vue b/src/js/components/CategoryWeighting.vue index becc064d..971d89f5 100644 --- a/src/js/components/CategoryWeighting.vue +++ b/src/js/components/CategoryWeighting.vue @@ -46,10 +46,18 @@ :bgcolor="(index % 2 == 0) ? '#edf3fe' : '#fff'" > - - + + - + - @@ -71,8 +82,12 @@ > Save Weighting -

{{ hypo.grade }} ({{ hypo.fp }})

-

+

+ {{ hypo.grade }} ({{ hypo.fp }})
+

+
+
+

Note: Since teachers can adjust the weighting of each assignment as well, this number is not necessarily accurate. In addition, early in the year some categories(i.e the exam category) may contain no grades and the percentages would need to be adjusted accordingly.

@@ -132,9 +147,13 @@ export default { catmap[e] = { weighting: 0, category: e }; }); } + const 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()); @@ -159,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); }, }, }; diff --git a/src/js/components/GradeRow.vue b/src/js/components/GradeRow.vue index 1ce642d4..8f9c5860 100644 --- a/src/js/components/GradeRow.vue +++ b/src/js/components/GradeRow.vue @@ -21,7 +21,7 @@ -->