-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat: default grade designations configurable from settings #32406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) { | |
| $('#course_grade_cutoff-tpl').text() | ||
| ); | ||
| this.setupCutoffs(); | ||
| this.setupGradeDesignations(options.gradeDesignations); | ||
|
|
||
| this.listenTo(this.model, 'invalid', this.handleValidationError); | ||
| this.listenTo(this.model, 'change', this.showNotificationBar); | ||
|
|
@@ -318,7 +319,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) { | |
| addNewGrade: function(e) { | ||
| e.preventDefault(); | ||
| var gradeLength = this.descendingCutoffs.length; // cutoffs doesn't include fail/f so this is only the passing grades | ||
| if (gradeLength > 3) { | ||
| if (gradeLength > this.GRADES.length - 1) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kaustavb12 could be a dumb question, but is there a possibility of Eg. if options.gradeDesignations == 0 then these lines will trigger an error: this.setupGradeDesignations([])
this.addNewGrade()
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great question. We already have a default value of The place which is most likely to break with an erroneous value of To mitigate that, I have now added a check to verify that |
||
| // TODO shouldn't we disable the button | ||
| return; | ||
| } | ||
|
|
@@ -399,6 +400,9 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) { | |
| this.descendingCutoffs = _.sortBy(this.descendingCutoffs, | ||
| function(gradeEle) { return -gradeEle.cutoff; }); | ||
| }, | ||
| setupGradeDesignations: function(gradeDesignations) { | ||
| if (Array.isArray(gradeDesignations) && gradeDesignations.length > 1) { this.GRADES = gradeDesignations.slice(0, 11); } | ||
| }, | ||
| revertView: function() { | ||
| var self = this; | ||
| this.model.fetch({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.