Add new instructor task for weighted problems
This commit is contained in:
committed by
Diana Huang
parent
9c32b1e878
commit
9269ec3b00
@@ -225,7 +225,7 @@ def _grade(student, request, course, keep_raw_scores):
|
||||
|
||||
graded = module_descriptor.graded
|
||||
if not total > 0:
|
||||
#We simply cannot grade a problem that is 12/0, because we might need it as a percentage
|
||||
# We simply cannot grade a problem that is 12/0, because we might need it as a percentage
|
||||
graded = False
|
||||
|
||||
scores.append(
|
||||
@@ -494,7 +494,7 @@ def manual_transaction():
|
||||
transaction.commit()
|
||||
|
||||
|
||||
def iterate_grades_for(course_or_id, students):
|
||||
def iterate_grades_for(course_or_id, students, keep_raw_scores=False):
|
||||
"""Given a course_id and an iterable of students (User), yield a tuple of:
|
||||
|
||||
(student, gradeset, err_msg) for every student enrolled in the course.
|
||||
@@ -531,7 +531,7 @@ def iterate_grades_for(course_or_id, students):
|
||||
# It's not pretty, but untangling that is currently beyond the
|
||||
# scope of this feature.
|
||||
request.session = {}
|
||||
gradeset = grade(student, request, course)
|
||||
gradeset = grade(student, request, course, keep_raw_scores)
|
||||
yield student, gradeset, ""
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
# Keep marching on even if this student couldn't be graded for
|
||||
|
||||
@@ -68,7 +68,7 @@ class TestGradeIteration(ModuleStoreTestCase):
|
||||
|
||||
def test_all_empty_grades(self):
|
||||
"""No students have grade entries"""
|
||||
all_gradesets, all_errors = self._gradesets_and_errors_for(self.course.id, self.students)
|
||||
all_gradesets, all_errors = self._gradesets_and_errors_for(self.course.id, self.students, keep_raw_scores=True)
|
||||
self.assertEqual(len(all_errors), 0)
|
||||
for gradeset in all_gradesets.values():
|
||||
self.assertIsNone(gradeset['grade'])
|
||||
@@ -107,7 +107,7 @@ class TestGradeIteration(ModuleStoreTestCase):
|
||||
self.assertTrue(all_gradesets[student5])
|
||||
|
||||
################################# Helpers #################################
|
||||
def _gradesets_and_errors_for(self, course_id, students):
|
||||
def _gradesets_and_errors_for(self, course_id, students, keep_raw_scores=False):
|
||||
"""Simple helper method to iterate through student grades and give us
|
||||
two dictionaries -- one that has all students and their respective
|
||||
gradesets, and one that has only students that could not be graded and
|
||||
@@ -115,7 +115,7 @@ class TestGradeIteration(ModuleStoreTestCase):
|
||||
students_to_gradesets = {}
|
||||
students_to_errors = {}
|
||||
|
||||
for student, gradeset, err_msg in iterate_grades_for(course_id, students):
|
||||
for student, gradeset, err_msg in iterate_grades_for(course_id, students, keep_raw_scores):
|
||||
students_to_gradesets[student] = gradeset
|
||||
if err_msg:
|
||||
students_to_errors[student] = err_msg
|
||||
|
||||
Reference in New Issue
Block a user