sas-fossdev / saspes

SAS Powerschool Enhancement Suite - A browser extension to improve the experience of using Powerschool at SAS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HypoAssignment Shows NaN with no Percentage Values

gary-kim opened this issue · comments

Extension Version: Open Beta 0.19.0 Development v0.19.0-9-g7722c9e

Describe steps to reproduce the error

Go to hypothetical assignment and remove the percentage value.

Screenshot from 2020-03-16 21-51-12

Looks like this is a regression from #129. Should be easy enough to fix.
Something like this should do the trick

diff --git a/src/js/components/HypoAssignment.vue b/src/js/components/HypoAssignment.vue
index 58da954..cf0f47a 100644
--- a/src/js/components/HypoAssignment.vue
+++ b/src/js/components/HypoAssignment.vue
@@ -70,7 +70,7 @@ export default {
     }),
     computed: {
         hypo () {
-            const weight = getInRange(this.assignment.weight, 0, 100, true);
+            const weight = getInRange(this.assignment.weight, 0, 100, true) || 0;
             const new_fp = weight * 0.01 * gradeToFP(this.assignment.grade) + ((100 - weight) * 0.01 * this.currentFP);
             return {
                 fp: new_fp.toFixed(2),