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
001587e4
Commit
001587e4
authored
Oct 15, 2015
by
Hasnain
Committed by
Chris Dodge
Oct 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template added if due date for exam has passed
parent
77a50e02
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
17 deletions
+95
-17
edx_proctoring/api.py
+70
-15
edx_proctoring/models.py
+5
-2
edx_proctoring/templates/proctored_exam/expired.html
+20
-0
edx_proctoring/tests/test_api.py
+0
-0
No files found.
edx_proctoring/api.py
View file @
001587e4
...
@@ -325,8 +325,42 @@ def update_exam_attempt(attempt_id, **kwargs):
...
@@ -325,8 +325,42 @@ def update_exam_attempt(attempt_id, **kwargs):
def
_has_due_date_passed
(
due_datetime
):
def
_has_due_date_passed
(
due_datetime
):
"""
"""
return True if due date is lesser than current datetime, otherwise False
return True if due date is lesser than current datetime, otherwise False
and if due_datetime is None then we don't have to consider the due date for return False
"""
"""
return
due_datetime
<=
datetime
.
now
(
pytz
.
UTC
)
if
due_datetime
:
return
due_datetime
<=
datetime
.
now
(
pytz
.
UTC
)
return
False
def
_create_and_decline_attempt
(
exam_id
,
user_id
):
"""
It will create the exam attempt and change the attempt's status to decline.
it will auto-decline further exams too
"""
create_exam_attempt
(
exam_id
,
user_id
)
update_attempt_status
(
exam_id
,
user_id
,
ProctoredExamStudentAttemptStatus
.
declined
,
raise_if_not_found
=
False
)
def
_create_and_expire_attempt
(
exam_id
,
user_id
):
"""
It will create the exam attempt and change the attempt's status to decline.
it will auto-decline further exams too
"""
create_exam_attempt
(
exam_id
,
user_id
)
update_attempt_status
(
exam_id
,
user_id
,
ProctoredExamStudentAttemptStatus
.
expired
,
raise_if_not_found
=
False
)
def
create_exam_attempt
(
exam_id
,
user_id
,
taking_as_proctored
=
False
):
def
create_exam_attempt
(
exam_id
,
user_id
,
taking_as_proctored
=
False
):
...
@@ -1116,6 +1150,11 @@ STATUS_SUMMARY_MAP = {
...
@@ -1116,6 +1150,11 @@ STATUS_SUMMARY_MAP = {
'short_description'
:
_
(
'Failed Proctoring'
),
'short_description'
:
_
(
'Failed Proctoring'
),
'suggested_icon'
:
'fa-exclamation-triangle'
,
'suggested_icon'
:
'fa-exclamation-triangle'
,
'in_completed_state'
:
True
'in_completed_state'
:
True
},
ProctoredExamStudentAttemptStatus
.
expired
:
{
'short_description'
:
_
(
'Exam Expired'
),
'suggested_icon'
:
'fa-exclamation-triangle'
,
'in_completed_state'
:
True
}
}
}
}
...
@@ -1135,6 +1174,11 @@ PRACTICE_STATUS_SUMMARY_MAP = {
...
@@ -1135,6 +1174,11 @@ PRACTICE_STATUS_SUMMARY_MAP = {
'short_description'
:
_
(
'Practice Exam Failed'
),
'short_description'
:
_
(
'Practice Exam Failed'
),
'suggested_icon'
:
'fa-exclamation-triangle'
,
'suggested_icon'
:
'fa-exclamation-triangle'
,
'in_completed_state'
:
True
'in_completed_state'
:
True
},
ProctoredExamStudentAttemptStatus
.
expired
:
{
'short_description'
:
_
(
'Exam Expired'
),
'suggested_icon'
:
'fa-exclamation-triangle'
,
'in_completed_state'
:
True
}
}
}
}
...
@@ -1230,10 +1274,16 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
...
@@ -1230,10 +1274,16 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
attempt_status
=
attempt
[
'status'
]
if
attempt
else
None
attempt_status
=
attempt
[
'status'
]
if
attempt
else
None
if
not
attempt_status
:
if
not
attempt_status
:
student_view_template
=
'timed_exam/entrance.html'
if
_has_due_date_passed
(
exam
[
'due_date'
]):
_create_and_expire_attempt
(
exam_id
,
user_id
)
student_view_template
=
'proctored_exam/expired.html'
else
:
student_view_template
=
'timed_exam/entrance.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
started
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
started
:
# when we're taking the exam we should override the view
# when we're taking the exam we should
not
override the view
return
None
return
None
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
expired
:
student_view_template
=
'proctored_exam/expired.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
ready_to_submit
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
ready_to_submit
:
student_view_template
=
'timed_exam/ready_to_submit.html'
student_view_template
=
'timed_exam/ready_to_submit.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
submitted
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
submitted
:
...
@@ -1335,10 +1385,16 @@ def _get_practice_exam_view(exam, context, exam_id, user_id, course_id):
...
@@ -1335,10 +1385,16 @@ def _get_practice_exam_view(exam, context, exam_id, user_id, course_id):
attempt_status
=
attempt
[
'status'
]
if
attempt
else
None
attempt_status
=
attempt
[
'status'
]
if
attempt
else
None
if
not
attempt_status
:
if
not
attempt_status
:
student_view_template
=
'practice_exam/entrance.html'
if
_has_due_date_passed
(
exam
[
'due_date'
]):
_create_and_expire_attempt
(
exam_id
,
user_id
)
student_view_template
=
'proctored_exam/expired.html'
else
:
student_view_template
=
'practice_exam/entrance.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
started
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
started
:
# when we're taking the exam we should override the view
# when we're taking the exam we should
not
override the view
return
None
return
None
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
expired
:
student_view_template
=
'proctored_exam/expired.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
created
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
created
:
provider
=
get_backend_provider
()
provider
=
get_backend_provider
()
student_view_template
=
'proctored_exam/instructions.html'
student_view_template
=
'proctored_exam/instructions.html'
...
@@ -1423,20 +1479,17 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
...
@@ -1423,20 +1479,17 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
'prerequisite_status'
:
prerequisite_status
'prerequisite_status'
:
prerequisite_status
})
})
if
not
prerequisite_status
[
'are_prerequisites_satisifed'
]:
# if exam due date has passed, then we can't take the exam
if
_has_due_date_passed
(
exam
[
'due_date'
]):
_create_and_expire_attempt
(
exam_id
,
user_id
)
student_view_template
=
'proctored_exam/expired.html'
elif
not
prerequisite_status
[
'are_prerequisites_satisifed'
]:
# do we have any declined prerequisites, if so, then we
# do we have any declined prerequisites, if so, then we
# will auto-decline this proctored exam
# will auto-decline this proctored exam
if
prerequisite_status
[
'declined_prerequisites'
]:
if
prerequisite_status
[
'declined_prerequisites'
]:
# user hasn't a record of attempt, create one now
# user hasn't a record of attempt, create one now
# so we can mark it as declined
# so we can mark it as declined
create_exam_attempt
(
exam_id
,
user_id
)
_create_and_decline_attempt
(
exam_id
,
user_id
)
update_attempt_status
(
exam_id
,
user_id
,
ProctoredExamStudentAttemptStatus
.
declined
,
raise_if_not_found
=
False
)
return
None
return
None
# do we have failed prerequisites? That takes priority in terms of
# do we have failed prerequisites? That takes priority in terms of
...
@@ -1458,8 +1511,10 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
...
@@ -1458,8 +1511,10 @@ def _get_proctored_exam_view(exam, context, exam_id, user_id, course_id):
else
:
else
:
student_view_template
=
'proctored_exam/entrance.html'
student_view_template
=
'proctored_exam/entrance.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
started
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
started
:
# when we're taking the exam we should override the view
# when we're taking the exam we should
not
override the view
return
None
return
None
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
expired
:
student_view_template
=
'proctored_exam/expired.html'
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
created
:
elif
attempt_status
==
ProctoredExamStudentAttemptStatus
.
created
:
provider
=
get_backend_provider
()
provider
=
get_backend_provider
()
student_view_template
=
'proctored_exam/instructions.html'
student_view_template
=
'proctored_exam/instructions.html'
...
...
edx_proctoring/models.py
View file @
001587e4
...
@@ -156,6 +156,9 @@ class ProctoredExamStudentAttemptStatus(object):
...
@@ -156,6 +156,9 @@ class ProctoredExamStudentAttemptStatus(object):
# the exam is believed to be in error
# the exam is believed to be in error
error
=
'error'
error
=
'error'
# the exam has expired, i.e. past due date
expired
=
'expired'
# status alias for sending email
# status alias for sending email
status_alias_mapping
=
{
status_alias_mapping
=
{
submitted
:
_
(
'pending'
),
submitted
:
_
(
'pending'
),
...
@@ -171,7 +174,7 @@ class ProctoredExamStudentAttemptStatus(object):
...
@@ -171,7 +174,7 @@ class ProctoredExamStudentAttemptStatus(object):
"""
"""
return
status
in
[
return
status
in
[
cls
.
declined
,
cls
.
timed_out
,
cls
.
submitted
,
cls
.
verified
,
cls
.
rejected
,
cls
.
declined
,
cls
.
timed_out
,
cls
.
submitted
,
cls
.
verified
,
cls
.
rejected
,
cls
.
not_reviewed
,
cls
.
error
cls
.
not_reviewed
,
cls
.
error
,
cls
.
expired
]
]
@classmethod
@classmethod
...
@@ -190,7 +193,7 @@ class ProctoredExamStudentAttemptStatus(object):
...
@@ -190,7 +193,7 @@ class ProctoredExamStudentAttemptStatus(object):
"""
"""
return
to_status
in
[
return
to_status
in
[
cls
.
verified
,
cls
.
rejected
,
cls
.
declined
,
cls
.
not_reviewed
,
cls
.
submitted
,
cls
.
verified
,
cls
.
rejected
,
cls
.
declined
,
cls
.
not_reviewed
,
cls
.
submitted
,
cls
.
error
cls
.
error
,
cls
.
expired
]
]
@classmethod
@classmethod
...
...
edx_proctoring/templates/proctored_exam/expired.html
0 → 100644
View file @
001587e4
{% load i18n %}
<div
class=
"sequence proctored-exam completed"
data-exam-id=
"{{exam_id}}"
>
<h3>
{% blocktrans %}
The due date for this exam has passed
{% endblocktrans %}
</h3>
<p>
{% blocktrans %}
Because the due date has passed, you are no longer able to take this exam.
{% endblocktrans %}
</p>
<hr>
<p>
{% blocktrans %}
View your credit eligibility status on your
<a
href=
"{{progress_page_url}}"
>
Progress
</a>
page.
{% endblocktrans %}
</p>
</div>
{% include 'proctored_exam/footer.html' %}
edx_proctoring/tests/test_api.py
View file @
001587e4
This diff is collapsed.
Click to expand it.
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