Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-proctoring
Commits
0302fe99
Commit
0302fe99
authored
Jul 30, 2015
by
Afzal Wali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the changes for create exam attempt for practice exams.
parent
795d41b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
23 deletions
+9
-23
edx_proctoring/api.py
+9
-15
edx_proctoring/tests/test_api.py
+0
-8
No files found.
edx_proctoring/api.py
View file @
0302fe99
...
...
@@ -210,25 +210,19 @@ def get_exam_attempt_by_code(attempt_code):
def
create_exam_attempt
(
exam_id
,
user_id
,
taking_as_proctored
=
False
):
"""
Creates an exam attempt for user_id against exam_id. There should only be
one exam_attempt per user per exam except for the practice exams where multiple
attempts are allowed. Multiple attempts by user will be archived
one exam_attempt per user per exam. Multiple attempts by user will be archived
in a separate table
"""
if
ProctoredExamStudentAttempt
.
objects
.
get_exam_attempt
(
exam_id
,
user_id
):
err_msg
=
(
'Cannot create new exam attempt for exam_id = {exam_id} and '
'user_id = {user_id} because it already exists!'
)
.
format
(
exam_id
=
exam_id
,
user_id
=
user_id
)
exam
=
get_exam_by_id
(
exam_id
)
existing_attempt
=
ProctoredExamStudentAttempt
.
objects
.
get_exam_attempt
(
exam_id
,
user_id
)
if
existing_attempt
:
if
exam
[
'is_practice_exam'
]:
# Archive the existing attempt by deleting it.
existing_attempt
.
delete_exam_attempt
()
else
:
err_msg
=
(
'Cannot create new exam attempt for exam_id = {exam_id} and '
'user_id = {user_id} because it already exists!'
)
.
format
(
exam_id
=
exam_id
,
user_id
=
user_id
)
raise
StudentExamAttemptAlreadyExistsException
(
err_msg
)
raise
StudentExamAttemptAlreadyExistsException
(
err_msg
)
# for now the student is allowed the exam default
exam
=
get_exam_by_id
(
exam_id
)
allowed_time_limit_mins
=
exam
[
'time_limit_mins'
]
# add in the allowed additional time
...
...
edx_proctoring/tests/test_api.py
View file @
0302fe99
...
...
@@ -368,14 +368,6 @@ class ProctoredExamApiTests(LoggedInTestCase):
with
self
.
assertRaises
(
StudentExamAttemptAlreadyExistsException
):
create_exam_attempt
(
proctored_exam_student_attempt
.
proctored_exam
.
id
,
self
.
user_id
)
def
test_recreate_a_practice_exam_attempt
(
self
):
# pylint: disable=invalid-name
"""
Taking the practice exam several times should not cause an exception.
"""
practice_exam_student_attempt
=
self
.
_create_started_practice_exam_attempt
()
new_attempt_id
=
create_exam_attempt
(
practice_exam_student_attempt
.
proctored_exam
.
id
,
self
.
user_id
)
self
.
assertGreater
(
practice_exam_student_attempt
,
new_attempt_id
,
"New attempt not created."
)
def
test_get_exam_attempt
(
self
):
"""
Test to get the existing exam attempt.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment