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
edx
edx-proctoring
Commits
9f46dc33
Commit
9f46dc33
authored
Aug 04, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweeks
parent
29219937
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
16 deletions
+35
-16
edx_proctoring/api.py
+19
-5
edx_proctoring/templates/proctoring/seq_proctored_exam_ready_to_submit.html
+15
-11
edx_proctoring/views.py
+1
-0
No files found.
edx_proctoring/api.py
View file @
9f46dc33
...
@@ -374,7 +374,7 @@ def _start_exam_attempt(existing_attempt):
...
@@ -374,7 +374,7 @@ def _start_exam_attempt(existing_attempt):
Helper method
Helper method
"""
"""
if
existing_attempt
.
started_at
:
if
existing_attempt
.
started_at
and
existing_attempt
.
status
==
ProctoredExamStudentAttemptStatus
.
started
:
# cannot restart an attempt
# cannot restart an attempt
err_msg
=
(
err_msg
=
(
'Cannot start exam attempt for exam_id = {exam_id} '
'Cannot start exam attempt for exam_id = {exam_id} '
...
@@ -488,7 +488,13 @@ def update_attempt_status(exam_id, user_id, to_status):
...
@@ -488,7 +488,13 @@ def update_attempt_status(exam_id, user_id, to_status):
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
()
if
to_status
==
ProctoredExamStudentAttemptStatus
.
started
:
# if we have transitioned to started and haven't set our
# started_at timestamp, do so now
add_start_time
=
(
to_status
==
ProctoredExamStudentAttemptStatus
.
started
and
not
exam_attempt_obj
.
started_at
)
if
add_start_time
:
exam_attempt_obj
.
started_at
=
datetime
.
now
(
pytz
.
UTC
)
exam_attempt_obj
.
started_at
=
datetime
.
now
(
pytz
.
UTC
)
exam_attempt_obj
.
save
()
exam_attempt_obj
.
save
()
...
@@ -692,10 +698,11 @@ def get_student_view(user_id, course_id, content_id,
...
@@ -692,10 +698,11 @@ def get_student_view(user_id, course_id, content_id,
if
attempt
and
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
declined
:
if
attempt
and
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
declined
:
return
None
return
None
does_time_remain
=
False
has_started_exam
=
attempt
and
attempt
.
get
(
'started_at'
)
has_started_exam
=
attempt
and
attempt
.
get
(
'started_at'
)
if
has_started_exam
:
if
has_started_exam
:
if
attempt
.
get
(
'status'
)
==
'error'
:
expires_at
=
attempt
[
'started_at'
]
+
timedelta
(
minutes
=
attempt
[
'allowed_time_limit_mins'
])
student_view_template
=
'proctoring/seq_proctored_exam_error.html'
does_time_remain
=
datetime
.
now
(
pytz
.
UTC
)
<
expires_at
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
...
@@ -716,6 +723,8 @@ def get_student_view(user_id, course_id, content_id,
...
@@ -716,6 +723,8 @@ def get_student_view(user_id, course_id, content_id,
})
})
else
:
else
:
student_view_template
=
'proctoring/seq_timed_exam_entrance.html'
student_view_template
=
'proctoring/seq_timed_exam_entrance.html'
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
error
:
student_view_template
=
'proctoring/seq_proctored_exam_error.html'
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
timed_out
:
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
timed_out
:
student_view_template
=
'proctoring/seq_timed_exam_expired.html'
student_view_template
=
'proctoring/seq_timed_exam_expired.html'
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
submitted
:
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
submitted
:
...
@@ -752,11 +761,16 @@ def get_student_view(user_id, course_id, content_id,
...
@@ -752,11 +761,16 @@ def get_student_view(user_id, course_id, content_id,
'exam_id'
:
exam_id
,
'exam_id'
:
exam_id
,
'progress_page_url'
:
progress_page_url
,
'progress_page_url'
:
progress_page_url
,
'is_sample_attempt'
:
attempt
[
'is_sample_attempt'
]
if
attempt
else
False
,
'is_sample_attempt'
:
attempt
[
'is_sample_attempt'
]
if
attempt
else
False
,
'does_time_remain'
:
does_time_remain
,
'enter_exam_endpoint'
:
reverse
(
'edx_proctoring.proctored_exam.attempt.collection'
),
'enter_exam_endpoint'
:
reverse
(
'edx_proctoring.proctored_exam.attempt.collection'
),
'exam_started_poll_url'
:
reverse
(
'exam_started_poll_url'
:
reverse
(
'edx_proctoring.proctored_exam.attempt'
,
'edx_proctoring.proctored_exam.attempt'
,
args
=
[
attempt
[
'id'
]]
args
=
[
attempt
[
'id'
]]
)
if
attempt
else
''
)
if
attempt
else
''
,
'change_state_url'
:
reverse
(
'edx_proctoring.proctored_exam.attempt'
,
args
=
[
attempt
[
'id'
]]
)
if
attempt
else
''
,
})
})
return
template
.
render
(
django_context
)
return
template
.
render
(
django_context
)
...
...
edx_proctoring/templates/proctoring/seq_proctored_exam_ready_to_submit.html
View file @
9f46dc33
...
@@ -11,17 +11,21 @@
...
@@ -11,17 +11,21 @@
Your worked will then be graded and your proctored session will be reviewed separately.
Your worked will then be graded and your proctored session will be reviewed separately.
{% endblocktrans %}
{% endblocktrans %}
</p>
</p>
<button
type=
"button"
name=
"submit-proctored-exam"
class=
"exam-action-button"
data-action=
"submit"
data-exam-id=
"{{exam_id}}"
data-change-state-url=
"{{data-change-state-url}}"
>
<div>
{% blocktrans %}
<button
type=
"button"
name=
"submit-proctored-exam"
class=
"exam-action-button"
data-action=
"submit"
data-exam-id=
"{{exam_id}}"
data-change-state-url=
"{{change_state_url}}"
>
I'm ready! Submit my answers and end my proctored exam.
{% endblocktrans %}
</button>
{% if does_time_remain %}
<button
type=
"button"
name=
"goback-proctored-exam"
class=
"exam-action-button"
data-action=
"start"
data-exam-id=
"{{exam_id}}"
data-change-state-url=
"{{data-change-state-url}}"
>
{% blocktrans %}
{% blocktrans %}
No, I am not ready! I'd like to continue my work
.
I'm ready! Submit my answers and end my proctored exam
.
{% endblocktrans %}
{% endblocktrans %}
</button>
</button>
</div>
{% if does_time_remain %}
<div>
<button
type=
"button"
name=
"goback-proctored-exam"
class=
"exam-action-button"
data-action=
"start"
data-exam-id=
"{{exam_id}}"
data-change-state-url=
"{{change_state_url}}"
>
{% blocktrans %}
No, I am not ready! I'd like to continue my work.
{% endblocktrans %}
</button>
</div>
{% endif %}
{% endif %}
</div>
</div>
<div
class=
"footer-sequence border-b-0 padding-b-0"
>
<div
class=
"footer-sequence border-b-0 padding-b-0"
>
...
@@ -37,13 +41,13 @@
...
@@ -37,13 +41,13 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
'.exam-action-button'
).
click
(
$
(
'.exam-action-button'
).
click
(
function
(
event
)
{
function
(
event
)
{
var
action_url
=
$
(
this
).
data
(
'
data-
change-state-url'
);
var
action_url
=
$
(
this
).
data
(
'change-state-url'
);
var
exam_id
=
$
(
this
).
data
(
'exam-id'
);
var
exam_id
=
$
(
this
).
data
(
'exam-id'
);
var
action
=
$
(
this
).
data
(
'
data-
action'
)
var
action
=
$
(
this
).
data
(
'action'
)
// Update the state of the attempt
// Update the state of the attempt
$
.
ajax
({
$
.
ajax
({
url
:
url
,
url
:
action_
url
,
type
:
'PUT'
,
type
:
'PUT'
,
data
:
{
data
:
{
action
:
action
action
:
action
...
...
edx_proctoring/views.py
View file @
9f46dc33
...
@@ -346,6 +346,7 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView):
...
@@ -346,6 +346,7 @@ class StudentProctoredExamAttempt(AuthenticatedAPIView):
return
Response
({
"exam_attempt_id"
:
exam_attempt_id
})
return
Response
({
"exam_attempt_id"
:
exam_attempt_id
})
except
ProctoredBaseException
,
ex
:
except
ProctoredBaseException
,
ex
:
LOG
.
exception
(
ex
)
return
Response
(
return
Response
(
status
=
status
.
HTTP_400_BAD_REQUEST
,
status
=
status
.
HTTP_400_BAD_REQUEST
,
data
=
{
"detail"
:
str
(
ex
)}
data
=
{
"detail"
:
str
(
ex
)}
...
...
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