Commit 38bcaeb7 by Afzal Wali

Some integration changes.

parent 015c4c23
...@@ -36,7 +36,7 @@ def create_exam(course_id, content_id, exam_name, time_limit_mins, ...@@ -36,7 +36,7 @@ def create_exam(course_id, content_id, exam_name, time_limit_mins,
is_proctored=is_proctored, is_proctored=is_proctored,
is_active=is_active is_active=is_active
) )
return proctored_exam return proctored_exam.id
def update_exam(exam_id, exam_name=None, time_limit_mins=None, def update_exam(exam_id, exam_name=None, time_limit_mins=None,
...@@ -62,7 +62,7 @@ def update_exam(exam_id, exam_name=None, time_limit_mins=None, ...@@ -62,7 +62,7 @@ def update_exam(exam_id, exam_name=None, time_limit_mins=None,
if is_active is not None: if is_active is not None:
proctored_exam.is_active = is_active proctored_exam.is_active = is_active
proctored_exam.save() proctored_exam.save()
return proctored_exam return proctored_exam.id
def get_exam_by_id(exam_id): def get_exam_by_id(exam_id):
...@@ -118,7 +118,7 @@ def start_exam_attempt(exam_id, user_id, external_id): ...@@ -118,7 +118,7 @@ def start_exam_attempt(exam_id, user_id, external_id):
if exam_attempt_obj is None: if exam_attempt_obj is None:
raise StudentExamAttemptAlreadyExistException raise StudentExamAttemptAlreadyExistException
else: else:
return exam_attempt_obj return exam_attempt_obj.id
def stop_exam_attempt(exam_id, user_id): def stop_exam_attempt(exam_id, user_id):
...@@ -131,7 +131,7 @@ def stop_exam_attempt(exam_id, user_id): ...@@ -131,7 +131,7 @@ def stop_exam_attempt(exam_id, user_id):
else: else:
exam_attempt_obj.completed_at = datetime.now(pytz.UTC) exam_attempt_obj.completed_at = datetime.now(pytz.UTC)
exam_attempt_obj.save() exam_attempt_obj.save()
return exam_attempt_obj return exam_attempt_obj.id
def get_active_exams_for_user(user_id, course_id=None): def get_active_exams_for_user(user_id, course_id=None):
......
...@@ -217,9 +217,9 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView): ...@@ -217,9 +217,9 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView):
try: try:
exam_attempt_id = stop_exam_attempt( exam_attempt_id = stop_exam_attempt(
exam_id=request.DATA.get('exam_id', ""), exam_id=request.DATA.get('exam_id', ""),
user=request.DATA.get('user_id', "") user_id=request.DATA.get('user_id', "")
) )
return Response() return Response({"exam_attempt_id": exam_attempt_id})
except Exception: except Exception:
return Response( return Response(
......
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