Commit e26509ae by Afzal Wali Committed by Muhammad Shoaib

quality improvements

parent c76d282c
...@@ -361,6 +361,7 @@ def get_all_exam_attempts(course_id): ...@@ -361,6 +361,7 @@ def get_all_exam_attempts(course_id):
exam_attempts = ProctoredExamStudentAttempt.get_all_exam_attempts(course_id) exam_attempts = ProctoredExamStudentAttempt.get_all_exam_attempts(course_id)
return [ProctoredExamStudentAttemptSerializer(active_exam).data for active_exam in exam_attempts] return [ProctoredExamStudentAttemptSerializer(active_exam).data for active_exam in exam_attempts]
def get_filtered_exam_attempts(course_id, search_by): def get_filtered_exam_attempts(course_id, search_by):
""" """
returns all exam attempts for a course id filtered by the search_by string in user names and emails. returns all exam attempts for a course id filtered by the search_by string in user names and emails.
...@@ -368,6 +369,7 @@ def get_filtered_exam_attempts(course_id, search_by): ...@@ -368,6 +369,7 @@ def get_filtered_exam_attempts(course_id, search_by):
exam_attempts = ProctoredExamStudentAttempt.get_all_exam_attempts(course_id) exam_attempts = ProctoredExamStudentAttempt.get_all_exam_attempts(course_id)
return [ProctoredExamStudentAttemptSerializer(active_exam).data for active_exam in exam_attempts] return [ProctoredExamStudentAttemptSerializer(active_exam).data for active_exam in exam_attempts]
def get_active_exams_for_user(user_id, course_id=None): def get_active_exams_for_user(user_id, course_id=None):
""" """
This method will return a list of active exams for the user, This method will return a list of active exams for the user,
......
...@@ -41,7 +41,8 @@ urlpatterns = patterns( # pylint: disable=invalid-name ...@@ -41,7 +41,8 @@ urlpatterns = patterns( # pylint: disable=invalid-name
name='edx_proctoring.proctored_exam.attempt' name='edx_proctoring.proctored_exam.attempt'
), ),
url( url(
r'edx_proctoring/v1/proctored_exam/attempt/course_id/{}/search/(?P<search_by>.+)$'.format(settings.COURSE_ID_PATTERN), r'edx_proctoring/v1/proctored_exam/attempt/course_id/{}/search/(?P<search_by>.+)$'.format(
settings.COURSE_ID_PATTERN),
views.StudentProctoredExamAttemptCollection.as_view(), views.StudentProctoredExamAttemptCollection.as_view(),
name='edx_proctoring.proctored_exam.attempt.search' name='edx_proctoring.proctored_exam.attempt.search'
), ),
......
...@@ -42,6 +42,8 @@ from edx_proctoring.serializers import ProctoredExamSerializer ...@@ -42,6 +42,8 @@ from edx_proctoring.serializers import ProctoredExamSerializer
from .utils import AuthenticatedAPIView from .utils import AuthenticatedAPIView
ATTEMPTS_PER_PAGE = 1
LOG = logging.getLogger("edx_proctoring_views") LOG = logging.getLogger("edx_proctoring_views")
...@@ -400,8 +402,7 @@ class StudentProctoredExamAttemptCollection(AuthenticatedAPIView): ...@@ -400,8 +402,7 @@ class StudentProctoredExamAttemptCollection(AuthenticatedAPIView):
exam_attempts = get_all_exam_attempts(course_id) exam_attempts = get_all_exam_attempts(course_id)
attempt_url = reverse('edx_proctoring.proctored_exam.attempt', args=[course_id]) attempt_url = reverse('edx_proctoring.proctored_exam.attempt', args=[course_id])
# TODO have to change the default attempts per page paginator = Paginator(exam_attempts, ATTEMPTS_PER_PAGE)
paginator = Paginator(exam_attempts, 1) # Show 1 attempts per page
page = request.GET.get('page') page = request.GET.get('page')
try: try:
exam_attempts_page = paginator.page(page) exam_attempts_page = paginator.page(page)
......
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