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
2f9b287c
Commit
2f9b287c
authored
Aug 05, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose new api method to give a summary of attempt status on a sequence
parent
3e6edabd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
edx_proctoring/api.py
+75
-0
No files found.
edx_proctoring/api.py
View file @
2f9b287c
...
@@ -646,6 +646,81 @@ def _check_credit_eligibility(credit_state):
...
@@ -646,6 +646,81 @@ def _check_credit_eligibility(credit_state):
return
True
return
True
def
get_attempt_status_summary
(
user_id
,
course_id
,
content_id
):
"""
Returns a summary about the status of the attempt for the user
in the course_id and content_id
Return will be:
None: Not applicable
- or -
{
'status': ['eligible', 'declined', 'submitted', 'verified', 'rejected'],
'short_description': <short description of status>,
'suggested-icon': <recommended font-awesome icon to use>
}
"""
# as a quick exit, let's check credit eligibility
credit_service
=
get_runtime_service
(
'credit'
)
if
credit_service
:
credit_state
=
credit_service
.
get_credit_state
(
user_id
,
unicode
(
course_id
))
if
not
_check_credit_eligibility
(
credit_state
):
return
None
try
:
exam
=
get_exam_by_content_id
(
course_id
,
content_id
)
except
ProctoredExamNotFoundException
,
ex
:
# this really shouldn't happen, but log it at least
log
.
exception
(
ex
)
return
None
attempt
=
get_exam_attempt
(
exam_id
,
user_id
)
if
not
attempt
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'short_description'
:
_
(
'Proctored Option Available'
),
'suggested-icon'
:
'fa-lock'
}
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
declined
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'short_description'
:
_
(
'Taking As Open Exam'
),
'suggested-icon'
:
'fa-unlock'
}
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
submitted
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
submitted
,
'short_description'
:
_
(
'Pending Session Review'
),
'suggested-icon'
:
'fa-unlock'
}
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
verified
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
submitted
,
'short_description'
:
_
(
'Passed Proctoring'
),
'suggested-icon'
:
'fa-check'
}
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
rejected
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
rejected
,
'short_description'
:
_
(
'Failed Proctoring'
),
'suggested-icon'
:
'fa-exclamation-triangle'
}
elif
attempt
[
'status'
]
==
ProctoredExamStudentAttemptStatus
.
started
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
started
,
'short_description'
:
_
(
'Taking As Proctored Exam'
),
'suggested-icon'
:
'fa-lock'
}
else
:
return
{
'status'
:
ProctoredExamStudentAttemptStatus
.
eligible
,
'short_description'
:
_
(
'Proctored Option Available'
),
'suggested-icon'
:
'fa-lock'
}
def
get_student_view
(
user_id
,
course_id
,
content_id
,
def
get_student_view
(
user_id
,
course_id
,
content_id
,
context
,
user_role
=
'student'
):
context
,
user_role
=
'student'
):
"""
"""
...
...
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