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
6f90af77
Commit
6f90af77
authored
Jul 13, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHX-11 Initial Work
parent
edc4d2a1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
edx_proctoring/api.py
+8
-0
edx_proctoring/models.py
+8
-0
edx_proctoring/urls.py
+5
-0
edx_proctoring/views.py
+1
-2
No files found.
edx_proctoring/api.py
View file @
6f90af77
...
...
@@ -336,6 +336,14 @@ def get_all_exams_for_course(course_id):
return
[
ProctoredExamSerializer
(
proctored_exam
)
.
data
for
proctored_exam
in
exams
]
def
get_all_exam_attempts
(
course_id
):
"""
Returns all the exam attempts for the course id.
"""
exam_attempts
=
ProctoredExamStudentAttempt
.
get_all_exam_attempts
(
course_id
)
return
[
ProctoredExamStudentAttemptSerializer
(
active_exam
)
.
data
for
active_exam
in
exam_attempts
]
def
get_active_exams_for_user
(
user_id
,
course_id
=
None
):
"""
This method will return a list of active exams for the user,
...
...
edx_proctoring/models.py
View file @
6f90af77
...
...
@@ -184,6 +184,14 @@ class ProctoredExamStudentAttempt(TimeStampedModel):
return
exam_attempt_obj
@classmethod
def
get_all_exam_attempts
(
cls
,
course_id
):
"""
Returns the Student Exam Attempts for the given course_id.
"""
return
cls
.
objects
.
filter
(
proctored_exam__course_id
=
course_id
)
@classmethod
def
get_active_student_attempts
(
cls
,
user_id
,
course_id
=
None
):
"""
Returns the active student exams (user in-progress exams)
...
...
edx_proctoring/urls.py
View file @
6f90af77
...
...
@@ -36,6 +36,11 @@ urlpatterns = patterns( # pylint: disable=invalid-name
name
=
'edx_proctoring.proctored_exam.attempt'
),
url
(
r'edx_proctoring/v1/proctored_exam/attempt/course_id/{}$'
.
format
(
settings
.
COURSE_ID_PATTERN
),
views
.
StudentProctoredExamAttempt
.
as_view
(),
name
=
'edx_proctoring.proctored_exam.attempt'
),
url
(
r'edx_proctoring/v1/proctored_exam/attempt$'
,
views
.
StudentProctoredExamAttemptCollection
.
as_view
(),
name
=
'edx_proctoring.proctored_exam.attempt.collection'
...
...
edx_proctoring/views.py
View file @
6f90af77
...
...
@@ -358,11 +358,10 @@ class StudentProctoredExamAttemptCollection(AuthenticatedAPIView):
return the status of the exam attempt
"""
def
get
(
self
,
request
):
def
get
(
self
,
request
,
course_id
=
None
):
# pylint: disable=unused-argument
"""
HTTP GET Handler. Returns the status of the exam attempt.
"""
exams
=
get_active_exams_for_user
(
request
.
user
.
id
)
if
exams
:
...
...
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