Unverified Commit 15a7dd9a by Rabia Iftikhar Committed by GitHub

Merge pull request #430 from…

Merge pull request #430 from edx/ri/EDUCATOR-2748-give-proctored-exams-access-to-course-staff-in-allowance-section

EDUCATOR-2748 give proctored exams access to course staff in allowance section under special exams tab
parents d5d1a905 f50c4aa8
......@@ -1131,7 +1131,7 @@ def remove_exam_attempt(attempt_id, requesting_user):
emit_event(exam, 'deleted', attempt=attempt)
def get_all_exams_for_course(course_id, timed_exams_only=False, active_only=False):
def get_all_exams_for_course(course_id, active_only=False):
"""
This method will return all exams for a course. This will return a list
of dictionaries, whose schema is the same as what is returned in
......@@ -1157,8 +1157,7 @@ def get_all_exams_for_course(course_id, timed_exams_only=False, active_only=Fals
"""
exams = ProctoredExam.get_all_exams_for_course(
course_id,
active_only=active_only,
timed_exams_only=timed_exams_only
active_only=active_only
)
return [ProctoredExamSerializer(proctored_exam).data for proctored_exam in exams]
......
......@@ -99,8 +99,7 @@ class ProctoredExam(TimeStampedModel):
return proctored_exam
@classmethod
def get_all_exams_for_course(cls, course_id, active_only=False, timed_exams_only=False,
proctored_exams_only=False):
def get_all_exams_for_course(cls, course_id, active_only=False, proctored_exams_only=False):
"""
Returns all exams for a give course
"""
......@@ -108,8 +107,6 @@ class ProctoredExam(TimeStampedModel):
if active_only:
filtered_query = filtered_query & Q(is_active=True)
if timed_exams_only:
filtered_query = filtered_query & Q(is_proctored=False)
if proctored_exams_only:
filtered_query = filtered_query & Q(is_proctored=True) & Q(is_practice_exam=False)
......
......@@ -193,7 +193,7 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
self.assertEqual(proctored_exam['content_id'], self.content_id)
self.assertEqual(proctored_exam['exam_name'], self.exam_name)
exams = get_all_exams_for_course(self.course_id, False)
exams = get_all_exams_for_course(self.course_id)
self.assertEqual(len(exams), 4)
def test_create_exam_review_policy(self):
......@@ -365,8 +365,8 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
self.assertEqual(timed_exam['content_id'], self.content_id_timed)
self.assertEqual(timed_exam['exam_name'], self.exam_name)
exams = get_all_exams_for_course(self.course_id, True)
self.assertEqual(len(exams), 2)
exams = get_all_exams_for_course(self.course_id)
self.assertEqual(len(exams), 4)
def test_get_invalid_proctored_exam(self):
"""
......
......@@ -256,10 +256,8 @@ class ProctoredExamView(AuthenticatedAPIView):
data={"detail": "The exam with course_id, content_id does not exist."}
)
else:
timed_exams_only = not request.user.is_staff
result_set = get_all_exams_for_course(
course_id=course_id,
timed_exams_only=timed_exams_only,
active_only=True
)
return Response(result_set)
......
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