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
e71f7188
Commit
e71f7188
authored
Jul 31, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the attempt status to timeout if appropriate when reading the attempt
parent
7c13841d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
edx_proctoring/api.py
+1
-11
edx_proctoring/tests/test_api.py
+26
-2
No files found.
edx_proctoring/api.py
View file @
e71f7188
...
@@ -590,20 +590,10 @@ def get_student_view(user_id, course_id, content_id,
...
@@ -590,20 +590,10 @@ def get_student_view(user_id, course_id, content_id,
attempt
=
get_exam_attempt
(
exam_id
,
user_id
)
attempt
=
get_exam_attempt
(
exam_id
,
user_id
)
has_started_exam
=
attempt
and
attempt
.
get
(
'started_at'
)
has_started_exam
=
attempt
and
attempt
.
get
(
'started_at'
)
has_time_expired
=
False
if
has_started_exam
:
if
has_started_exam
:
if
attempt
.
get
(
'status'
)
==
'error'
:
if
attempt
.
get
(
'status'
)
==
'error'
:
student_view_template
=
'proctoring/seq_proctored_exam_error.html'
student_view_template
=
'proctoring/seq_proctored_exam_error.html'
else
:
now_utc
=
datetime
.
now
(
pytz
.
UTC
)
expires_at
=
attempt
[
'started_at'
]
+
timedelta
(
minutes
=
attempt
[
'allowed_time_limit_mins'
])
has_time_expired
=
now_utc
>
expires_at
# make sure the attempt has been marked as timed_out, if need be
if
has_time_expired
and
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
started
:
mark_exam_attempt_timeout
(
exam_id
,
user_id
)
# refetch since we are transitioning state
attempt
=
get_exam_attempt
(
exam_id
,
user_id
)
if
not
has_started_exam
:
if
not
has_started_exam
:
# determine whether to show a timed exam only entrance screen
# determine whether to show a timed exam only entrance screen
...
...
edx_proctoring/tests/test_api.py
View file @
e71f7188
"""
"""
All tests for the models.py
All tests for the models.py
"""
"""
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
from
mock
import
patch
from
mock
import
patch
import
pytz
import
pytz
from
freezegun
import
freeze_time
from
edx_proctoring.api
import
(
from
edx_proctoring.api
import
(
create_exam
,
create_exam
,
...
@@ -703,6 +703,30 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -703,6 +703,30 @@ class ProctoredExamApiTests(LoggedInTestCase):
)
)
self
.
assertIsNone
(
rendered_response
)
self
.
assertIsNone
(
rendered_response
)
def
test_get_studentview_timedout
(
self
):
"""
Verifies that if we call get_studentview when the timer has expired
it will automatically state transition into timed_out
"""
attempt_obj
=
self
.
_create_started_exam_attempt
()
reset_time
=
datetime
.
now
(
pytz
.
UTC
)
+
timedelta
(
days
=
1
)
with
freeze_time
(
reset_time
):
get_student_view
(
user_id
=
self
.
user_id
,
course_id
=
self
.
course_id
,
content_id
=
self
.
content_id
,
context
=
{
'is_proctored'
:
True
,
'display_name'
:
self
.
exam_name
,
'default_time_limit_mins'
:
90
}
)
attempt
=
get_exam_attempt_by_id
(
attempt_obj
.
id
)
self
.
assertEqual
(
attempt
[
'status'
],
'timed_out'
)
def
test_get_studentview_submitted_status
(
self
):
# pylint: disable=invalid-name
def
test_get_studentview_submitted_status
(
self
):
# pylint: disable=invalid-name
"""
"""
Test for get_student_view proctored exam which has been submitted.
Test for get_student_view proctored exam which has been submitted.
...
...
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