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
b34543ba
Commit
b34543ba
authored
Aug 06, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set status indicators for practice exams
parent
dca995b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
5 deletions
+74
-5
edx_proctoring/api.py
+24
-3
edx_proctoring/tests/test_api.py
+50
-2
No files found.
edx_proctoring/api.py
View file @
b34543ba
...
...
@@ -782,6 +782,25 @@ STATUS_SUMMARY_MAP = {
}
PRACTICE_STATUS_SUMMARY_MAP
=
{
'_default'
:
{
'short_description'
:
_
(
'Ungraded Practice Exam'
),
'suggested_icon'
:
'fa-lock'
,
'in_completed_state'
:
False
},
ProctoredExamStudentAttemptStatus
.
submitted
:
{
'short_description'
:
_
(
'Practice Exam Completed'
),
'suggested_icon'
:
'fa-check'
,
'in_completed_state'
:
True
},
ProctoredExamStudentAttemptStatus
.
error
:
{
'short_description'
:
_
(
'Practice Exam Failed'
),
'suggested_icon'
:
'fa-exclamation-triangle'
,
'in_completed_state'
:
True
}
}
def
get_attempt_status_summary
(
user_id
,
course_id
,
content_id
):
"""
Returns a summary about the status of the attempt for the user
...
...
@@ -815,11 +834,13 @@ def get_attempt_status_summary(user_id, course_id, content_id):
attempt
=
get_exam_attempt
(
exam
[
'id'
],
user_id
)
status
=
attempt
[
'status'
]
if
attempt
else
ProctoredExamStudentAttemptStatus
.
eligible
status_map
=
STATUS_SUMMARY_MAP
if
not
attempt
[
'is_sample_attempt'
]
else
PRACTICE_STATUS_SUMMARY_MAP
summary
=
None
if
status
in
STATUS_SUMMARY_MAP
:
summary
=
STATUS_SUMMARY_MAP
[
status
]
if
status
in
status_map
:
summary
=
status_map
[
status
]
else
:
summary
=
STATUS_SUMMARY_MAP
[
'_default'
]
summary
=
status_map
[
'_default'
]
summary
.
update
({
"status"
:
status
})
...
...
edx_proctoring/tests/test_api.py
View file @
b34543ba
...
...
@@ -169,7 +169,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
status
=
'created'
)
def
_create_started_exam_attempt
(
self
,
started_at
=
None
,
is_proctored
=
True
):
def
_create_started_exam_attempt
(
self
,
started_at
=
None
,
is_proctored
=
True
,
is_sample_attempt
=
False
):
"""
Creates the ProctoredExamStudentAttempt object.
"""
...
...
@@ -179,7 +179,8 @@ class ProctoredExamApiTests(LoggedInTestCase):
external_id
=
self
.
external_id
,
started_at
=
started_at
if
started_at
else
datetime
.
now
(
pytz
.
UTC
),
status
=
ProctoredExamStudentAttemptStatus
.
started
,
allowed_time_limit_mins
=
10
allowed_time_limit_mins
=
10
,
is_sample_attempt
=
is_sample_attempt
)
def
_create_started_practice_exam_attempt
(
self
,
started_at
=
None
):
# pylint: disable=invalid-name
...
...
@@ -1268,6 +1269,53 @@ class ProctoredExamApiTests(LoggedInTestCase):
self
.
assertIn
(
summary
,
[
expected
])
@ddt.data
(
(
ProctoredExamStudentAttemptStatus
.
eligible
,
{
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'short_description'
:
'Ungraded Practice Exam'
,
'suggested_icon'
:
'fa-lock'
,
'in_completed_state'
:
False
}
),
(
ProctoredExamStudentAttemptStatus
.
submitted
,
{
'status'
:
ProctoredExamStudentAttemptStatus
.
submitted
,
'short_description'
:
'Practice Exam Completed'
,
'suggested_icon'
:
'fa-check'
,
'in_completed_state'
:
True
}
),
(
ProctoredExamStudentAttemptStatus
.
error
,
{
'status'
:
ProctoredExamStudentAttemptStatus
.
error
,
'short_description'
:
'Practice Exam Failed'
,
'suggested_icon'
:
'fa-exclamation-triangle'
,
'in_completed_state'
:
True
}
)
)
@ddt.unpack
def
test_practice_status_summary
(
self
,
status
,
expected
):
"""
Assert that we get the expected status summaries
"""
exam_attempt
=
self
.
_create_started_exam_attempt
(
is_sample_attempt
=
True
)
update_attempt_status
(
exam_attempt
.
proctored_exam_id
,
self
.
user
.
id
,
status
)
summary
=
get_attempt_status_summary
(
self
.
user
.
id
,
exam_attempt
.
proctored_exam
.
course_id
,
exam_attempt
.
proctored_exam
.
content_id
)
self
.
assertIn
(
summary
,
[
expected
])
@ddt.data
(
'honor'
,
'staff'
)
def
test_status_summary_honor
(
self
,
enrollment_mode
):
...
...
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