Commit 1b93dd12 by cahrens

Sort the grade cutoffs.

TNL-2848
parent cc7762e0
...@@ -33,7 +33,9 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -33,7 +33,9 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase):
Set up tests Set up tests
""" """
super(TestInstructorDashboard, self).setUp() super(TestInstructorDashboard, self).setUp()
self.course = CourseFactory.create() self.course = CourseFactory.create(
grading_policy={"GRADE_CUTOFFS": {"A": 0.75, "B": 0.63, "C": 0.57, "D": 0.5}}
)
self.course_mode = CourseMode(course_id=self.course.id, self.course_mode = CourseMode(course_id=self.course.id,
mode_slug="honor", mode_slug="honor",
...@@ -234,3 +236,10 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -234,3 +236,10 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase):
expected_result, expected_result,
'CCX Coaches are able to create their own Custom Courses based on this course' in response.content 'CCX Coaches are able to create their own Custom Courses based on this course' in response.content
) )
def test_grade_cutoffs(self):
"""
Verify that grade cutoffs are displayed in the correct order.
"""
response = self.client.get(self.url)
self.assertIn('D: 0.5, C: 0.57, B: 0.63, A: 0.75', response.content)
...@@ -349,8 +349,9 @@ def _section_course_info(course, access): ...@@ -349,8 +349,9 @@ def _section_course_info(course, access):
section_data['detailed_gitlogs_url'] = reverse('gitlogs_detail', kwargs={'course_id': unicode(course_key)}) section_data['detailed_gitlogs_url'] = reverse('gitlogs_detail', kwargs={'course_id': unicode(course_key)})
try: try:
sorted_cutoffs = sorted(course.grade_cutoffs.items(), key=lambda i: i[1], reverse=True)
advance = lambda memo, (letter, score): "{}: {}, ".format(letter, score) + memo advance = lambda memo, (letter, score): "{}: {}, ".format(letter, score) + memo
section_data['grade_cutoffs'] = reduce(advance, course.grade_cutoffs.items(), "")[:-2] section_data['grade_cutoffs'] = reduce(advance, sorted_cutoffs, "")[:-2]
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
section_data['grade_cutoffs'] = "Not Available" section_data['grade_cutoffs'] = "Not Available"
# section_data['offline_grades'] = offline_grades_available(course_key) # section_data['offline_grades'] = offline_grades_available(course_key)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment