Skip to content
Snippets Groups Projects
Commit 69b90275 authored by Peter Fogg's avatar Peter Fogg
Browse files

Merge pull request #8690 from edx/peter-fogg/fix-passing-grades

Fix not being able to set course passing grades above 80%.
parents 36e31e10 890cd6a4
No related branches found
No related tags found
No related merge requests found
define ["js/models/settings/course_grading_policy"], (CourseGradingPolicy) ->
define ["underscore", "js/models/settings/course_grading_policy"], (_, CourseGradingPolicy) ->
describe "CourseGradingPolicy", ->
beforeEach ->
@model = new CourseGradingPolicy()
......@@ -23,3 +23,14 @@ define ["js/models/settings/course_grading_policy"], (CourseGradingPolicy) ->
expect(@model.parseGracePeriod("asdf")).toBe(null)
expect(@model.parseGracePeriod("7:19")).toBe(null)
expect(@model.parseGracePeriod("1000:00")).toBe(null)
describe "validate", ->
it "enforces that the passing grade is <= the minimum grade to receive credit if credit is enabled", ->
@model.set({minimum_grade_credit: 0.8, grace_period: '01:00', is_credit_course: true})
@model.set('grade_cutoffs', [0.9], validate: true)
expect(_.keys(@model.validationError)).toContain('minimum_grade_credit')
it "does not enforce the passing grade limit in non-credit courses", ->
@model.set({minimum_grade_credit: 0.8, grace_period: '01:00', is_credit_course: false})
@model.set({grade_cutoffs: [0.9]}, validate: true)
expect(@model.validationError).toBe(null)
......@@ -76,7 +76,7 @@ var CourseGradingPolicy = Backbone.Model.extend({
}
}
}
if(_.has(attrs, 'minimum_grade_credit')) {
if(this.get('is_credit_course') && _.has(attrs, 'minimum_grade_credit')) {
var minimum_grade_cutoff = _.values(attrs.grade_cutoffs).pop();
if(isNaN(attrs.minimum_grade_credit) || attrs.minimum_grade_credit === null || attrs.minimum_grade_credit < minimum_grade_cutoff) {
return {
......
......@@ -5,6 +5,7 @@
<%namespace name='static' file='static_content.html'/>
<%!
import json
from contentstore import utils
from django.utils.translation import ugettext as _
%>
......@@ -22,7 +23,7 @@
</%block>
<%block name="requirejs">
require(["js/factories/settings_graders"], function(SettingsGradersFactory) {
SettingsGradersFactory(${course_details|n}, "${grading_url}");
SettingsGradersFactory(_.extend(${course_details|n}, {is_credit_course: ${json.dumps(is_credit_course)}}), "${grading_url}");
});
</%block>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment