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
6545e04f
Commit
6545e04f
authored
Oct 24, 2015
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #207 from edx/cdodge/add-allownaces-to-timed-exams
fix allowances for timed exams
parents
0a22ce62
fec6608d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
26 deletions
+19
-26
edx_proctoring/api.py
+5
-7
edx_proctoring/templates/timed_exam/entrance.html
+1
-1
edx_proctoring/tests/test_api.py
+13
-18
No files found.
edx_proctoring/api.py
View file @
6545e04f
...
@@ -1292,15 +1292,12 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
...
@@ -1292,15 +1292,12 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
# time limit, including any accommodations
# time limit, including any accommodations
allowed_time_limit_mins
=
exam
[
'time_limit_mins'
]
allowed_time_limit_mins
=
exam
[
'time_limit_mins'
]
allowance
=
ProctoredExamStudentAllowance
.
get_allowance_for_user
(
allowance_extra_mins
=
ProctoredExamStudentAllowance
.
get_additional_time_granted
(
exam_id
,
user_id
)
exam_id
,
user_id
,
"Additional time (minutes)"
)
if
allowance
:
if
allowance
_extra_mins
:
allowed_time_limit_mins
+=
int
(
allowance
.
value
)
allowed_time_limit_mins
+=
int
(
allowance
_extra_mins
)
# apply any cut off times according to due dates
allowed_time_limit_mins
,
_
=
_calculate_allowed_mins
(
allowed_time_limit_mins
,
_
=
_calculate_allowed_mins
(
exam
[
'due_date'
],
exam
[
'due_date'
],
allowed_time_limit_mins
allowed_time_limit_mins
...
@@ -1322,6 +1319,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
...
@@ -1322,6 +1319,7 @@ def _get_timed_exam_view(exam, context, exam_id, user_id, course_id):
django_context
.
update
({
django_context
.
update
({
'total_time'
:
total_time
,
'total_time'
:
total_time
,
'exam_id'
:
exam_id
,
'exam_id'
:
exam_id
,
'exam_name'
:
exam
[
'exam_name'
],
'progress_page_url'
:
progress_page_url
,
'progress_page_url'
:
progress_page_url
,
'does_time_remain'
:
_does_time_remain
(
attempt
),
'does_time_remain'
:
_does_time_remain
(
attempt
),
'enter_exam_endpoint'
:
reverse
(
'edx_proctoring.proctored_exam.attempt.collection'
),
'enter_exam_endpoint'
:
reverse
(
'edx_proctoring.proctored_exam.attempt.collection'
),
...
...
edx_proctoring/templates/timed_exam/entrance.html
View file @
6545e04f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div
class=
"sequence timed-exam entrance"
data-exam-id=
"{{exam_id}}"
>
<div
class=
"sequence timed-exam entrance"
data-exam-id=
"{{exam_id}}"
>
<h3>
<h3>
{% blocktrans %}
{% blocktrans %}
{{
display
_name }} is a Timed Exam ({{total_time}})
{{
exam
_name }} is a Timed Exam ({{total_time}})
{% endblocktrans %}
{% endblocktrans %}
</h3>
</h3>
<p>
<p>
...
...
edx_proctoring/tests/test_api.py
View file @
6545e04f
...
@@ -94,7 +94,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -94,7 +94,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
self
.
value
=
'Test Value'
self
.
value
=
'Test Value'
self
.
external_id
=
'test_external_id'
self
.
external_id
=
'test_external_id'
self
.
proctored_exam_id
=
self
.
_create_proctored_exam
()
self
.
proctored_exam_id
=
self
.
_create_proctored_exam
()
self
.
timed_exam
=
self
.
_create_timed_exam
()
self
.
timed_exam
_id
=
self
.
_create_timed_exam
()
self
.
practice_exam_id
=
self
.
_create_practice_exam
()
self
.
practice_exam_id
=
self
.
_create_practice_exam
()
self
.
disabled_exam_id
=
self
.
_create_disabled_exam
()
self
.
disabled_exam_id
=
self
.
_create_disabled_exam
()
...
@@ -262,7 +262,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -262,7 +262,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
else
:
else
:
exam_id
=
self
.
proctored_exam_id
exam_id
=
self
.
proctored_exam_id
else
:
else
:
exam_id
=
self
.
timed_exam
exam_id
=
self
.
timed_exam
_id
return
ProctoredExamStudentAttempt
.
objects
.
create
(
return
ProctoredExamStudentAttempt
.
objects
.
create
(
proctored_exam_id
=
exam_id
,
proctored_exam_id
=
exam_id
,
...
@@ -277,7 +277,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -277,7 +277,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
Creates the ProctoredExamStudentAttempt object.
Creates the ProctoredExamStudentAttempt object.
"""
"""
return
ProctoredExamStudentAttempt
.
objects
.
create
(
return
ProctoredExamStudentAttempt
.
objects
.
create
(
proctored_exam_id
=
self
.
proctored_exam_id
if
is_proctored
else
self
.
timed_exam
,
proctored_exam_id
=
self
.
proctored_exam_id
if
is_proctored
else
self
.
timed_exam
_id
,
user_id
=
self
.
user_id
,
user_id
=
self
.
user_id
,
external_id
=
self
.
external_id
,
external_id
=
self
.
external_id
,
started_at
=
started_at
if
started_at
else
datetime
.
now
(
pytz
.
UTC
),
started_at
=
started_at
if
started_at
else
datetime
.
now
(
pytz
.
UTC
),
...
@@ -400,7 +400,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -400,7 +400,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
test to get the exam by the exam_id and
test to get the exam by the exam_id and
then compare their values.
then compare their values.
"""
"""
timed_exam
=
get_exam_by_id
(
self
.
timed_exam
)
timed_exam
=
get_exam_by_id
(
self
.
timed_exam
_id
)
self
.
assertEqual
(
timed_exam
[
'course_id'
],
self
.
course_id
)
self
.
assertEqual
(
timed_exam
[
'course_id'
],
self
.
course_id
)
self
.
assertEqual
(
timed_exam
[
'content_id'
],
self
.
content_id_timed
)
self
.
assertEqual
(
timed_exam
[
'content_id'
],
self
.
content_id_timed
)
self
.
assertEqual
(
timed_exam
[
'exam_name'
],
self
.
exam_name
)
self
.
assertEqual
(
timed_exam
[
'exam_name'
],
self
.
exam_name
)
...
@@ -1594,29 +1594,26 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -1594,29 +1594,26 @@ class ProctoredExamApiTests(LoggedInTestCase):
But user has an allowance
But user has an allowance
"""
"""
ProctoredExamStudentAllowance
.
objects
.
create
(
allowed_extra_time
=
10
proctored_exam_id
=
self
.
timed_exam
,
add_allowance_for_user
(
user_id
=
self
.
user_id
,
self
.
timed_exam_id
,
key
=
'Additional time (minutes)'
,
self
.
user
.
username
,
value
=
15
ProctoredExamStudentAllowance
.
ADDITIONAL_TIME_GRANTED
,
str
(
allowed_extra_time
)
)
)
rendered_response
=
get_student_view
(
rendered_response
=
get_student_view
(
user_id
=
self
.
user_id
,
user_id
=
self
.
user_id
,
course_id
=
self
.
course_id
,
course_id
=
self
.
course_id
,
content_id
=
self
.
content_id_timed
,
content_id
=
self
.
content_id_timed
,
context
=
{
context
=
{}
'is_proctored'
:
False
,
'display_name'
:
self
.
exam_name
,
'default_time_limit_mins'
:
90
}
)
)
self
.
assertNotIn
(
self
.
assertNotIn
(
'data-exam-id="{proctored_exam_id}"'
.
format
(
proctored_exam_id
=
self
.
proctored_exam_id
),
'data-exam-id="{proctored_exam_id}"'
.
format
(
proctored_exam_id
=
self
.
proctored_exam_id
),
rendered_response
rendered_response
)
)
self
.
assertIn
(
self
.
timed_exam_msg
.
format
(
exam_name
=
self
.
exam_name
),
rendered_response
)
self
.
assertIn
(
self
.
timed_exam_msg
.
format
(
exam_name
=
self
.
exam_name
),
rendered_response
)
self
.
assertIn
(
'3
6
minutes'
,
rendered_response
)
self
.
assertIn
(
'3
1
minutes'
,
rendered_response
)
self
.
assertNotIn
(
self
.
start_an_exam_msg
.
format
(
exam_name
=
self
.
exam_name
),
rendered_response
)
self
.
assertNotIn
(
self
.
start_an_exam_msg
.
format
(
exam_name
=
self
.
exam_name
),
rendered_response
)
@ddt.data
(
@ddt.data
(
...
@@ -1643,9 +1640,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -1643,9 +1640,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
course_id
=
self
.
course_id
,
course_id
=
self
.
course_id
,
content_id
=
self
.
content_id_timed
,
content_id
=
self
.
content_id_timed
,
context
=
{
context
=
{
'is_proctored'
:
False
,
'display_name'
:
self
.
exam_name
,
'display_name'
:
self
.
exam_name
,
'default_time_limit_mins'
:
90
}
}
)
)
self
.
assertIn
(
expected_content
,
rendered_response
)
self
.
assertIn
(
expected_content
,
rendered_response
)
...
@@ -2049,7 +2044,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -2049,7 +2044,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
Assert that we get the expected status summaries
Assert that we get the expected status summaries
for the timed exams.
for the timed exams.
"""
"""
timed_exam
=
get_exam_by_id
(
self
.
timed_exam
)
timed_exam
=
get_exam_by_id
(
self
.
timed_exam
_id
)
summary
=
get_attempt_status_summary
(
summary
=
get_attempt_status_summary
(
self
.
user
.
id
,
self
.
user
.
id
,
timed_exam
[
'course_id'
],
timed_exam
[
'course_id'
],
...
...
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