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.
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),