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
ae47a13d
Commit
ae47a13d
authored
Jul 09, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed the duplicate method implementation
parent
ff31afa0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
48 deletions
+22
-48
edx_proctoring/api.py
+18
-28
edx_proctoring/models.py
+0
-8
edx_proctoring/tests/test_api.py
+0
-10
edx_proctoring/views.py
+4
-2
No files found.
edx_proctoring/api.py
View file @
ae47a13d
...
@@ -104,34 +104,6 @@ def get_exam_by_id(exam_id):
...
@@ -104,34 +104,6 @@ def get_exam_by_id(exam_id):
return
serialized_exam_object
.
data
return
serialized_exam_object
.
data
def
get_exams_by_course_id
(
course_id
):
"""
Looks up exam by the course_id. Raises exception if not found.
Returns a list containing dictionary version of the Django ORM object
e.g.
[{
"course_id": "edX/DemoX/Demo_Course",
"content_id": "123",
"external_id": "",
"exam_name": "Midterm",
"time_limit_mins": 90,
"is_proctored": true,
"is_active": true
},
{
...: ...,
...: ...
},
..
]
"""
proctored_exams
=
ProctoredExam
.
get_exams_by_course_id
(
course_id
)
serialized_proctored_exams
=
[
ProctoredExamSerializer
(
proctored_exam
)
.
data
for
proctored_exam
in
proctored_exams
]
return
serialized_proctored_exams
def
get_exam_by_content_id
(
course_id
,
content_id
):
def
get_exam_by_content_id
(
course_id
,
content_id
):
"""
"""
Looks up exam by the course_id/content_id pair. Raises exception if not found.
Looks up exam by the course_id/content_id pair. Raises exception if not found.
...
@@ -266,6 +238,24 @@ def get_all_exams_for_course(course_id):
...
@@ -266,6 +238,24 @@ def get_all_exams_for_course(course_id):
This method will return all exams for a course. This will return a list
This method will return all exams for a course. This will return a list
of dictionaries, whose schema is the same as what is returned in
of dictionaries, whose schema is the same as what is returned in
get_exam_by_id
get_exam_by_id
Returns a list containing dictionary version of the Django ORM object
e.g.
[{
"course_id": "edX/DemoX/Demo_Course",
"content_id": "123",
"external_id": "",
"exam_name": "Midterm",
"time_limit_mins": 90,
"is_proctored": true,
"is_active": true
},
{
...: ...,
...: ...
},
..
]
"""
"""
exams
=
ProctoredExam
.
get_all_exams_for_course
(
course_id
)
exams
=
ProctoredExam
.
get_all_exams_for_course
(
course_id
)
...
...
edx_proctoring/models.py
View file @
ae47a13d
...
@@ -44,14 +44,6 @@ class ProctoredExam(TimeStampedModel):
...
@@ -44,14 +44,6 @@ class ProctoredExam(TimeStampedModel):
db_table
=
'proctoring_proctoredexam'
db_table
=
'proctoring_proctoredexam'
@classmethod
@classmethod
def
get_exams_by_course_id
(
cls
,
course_id
):
"""
Returns the list of proctored exams
"""
return
cls
.
objects
.
filter
(
course_id
=
course_id
)
@classmethod
def
get_exam_by_content_id
(
cls
,
course_id
,
content_id
):
def
get_exam_by_content_id
(
cls
,
course_id
,
content_id
):
"""
"""
Returns the Proctored Exam if found else returns None,
Returns the Proctored Exam if found else returns None,
...
...
edx_proctoring/tests/test_api.py
View file @
ae47a13d
...
@@ -16,7 +16,6 @@ from edx_proctoring.api import (
...
@@ -16,7 +16,6 @@ from edx_proctoring.api import (
get_exam_attempt
,
get_exam_attempt
,
create_exam_attempt
,
create_exam_attempt
,
get_student_view
,
get_student_view
,
get_exams_by_course_id
,
get_allowances_for_course
,
get_allowances_for_course
,
get_all_exams_for_course
get_all_exams_for_course
)
)
...
@@ -120,15 +119,6 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -120,15 +119,6 @@ class ProctoredExamApiTests(LoggedInTestCase):
proctored_exam_id
=
self
.
proctored_exam_id
,
user_id
=
self
.
user_id
,
key
=
self
.
key
,
value
=
self
.
value
proctored_exam_id
=
self
.
proctored_exam_id
,
user_id
=
self
.
user_id
,
key
=
self
.
key
,
value
=
self
.
value
)
)
def
test_get_exams_by_course_id
(
self
):
"""
Test to get the exams by course_id
"""
proctored_exams
=
get_exams_by_course_id
(
self
.
course_id
)
self
.
assertEqual
(
len
(
proctored_exams
),
1
)
self
.
assertEqual
(
proctored_exams
[
0
][
'exam_name'
],
self
.
exam_name
)
self
.
assertEqual
(
proctored_exams
[
0
][
'course_id'
],
self
.
course_id
)
def
test_create_duplicate_exam
(
self
):
def
test_create_duplicate_exam
(
self
):
"""
"""
Test to create a proctored exam that has already exist in the
Test to create a proctored exam that has already exist in the
...
...
edx_proctoring/views.py
View file @
ae47a13d
...
@@ -21,7 +21,9 @@ from edx_proctoring.api import (
...
@@ -21,7 +21,9 @@ from edx_proctoring.api import (
remove_allowance_for_user
,
remove_allowance_for_user
,
get_active_exams_for_user
,
get_active_exams_for_user
,
create_exam_attempt
,
create_exam_attempt
,
get_allowances_for_course
,
get_exams_by_course_id
)
get_allowances_for_course
,
get_all_exams_for_course
)
from
edx_proctoring.exceptions
import
(
from
edx_proctoring.exceptions
import
(
ProctoredBaseException
,
ProctoredBaseException
,
ProctoredExamNotFoundException
,
ProctoredExamNotFoundException
,
...
@@ -190,7 +192,7 @@ class ProctoredExamView(AuthenticatedAPIView):
...
@@ -190,7 +192,7 @@ class ProctoredExamView(AuthenticatedAPIView):
data
=
{
"detail"
:
"The exam with course_id, content_id does not exist."
}
data
=
{
"detail"
:
"The exam with course_id, content_id does not exist."
}
)
)
else
:
else
:
result_set
=
get_
exams_by_course_id
(
result_set
=
get_
all_exams_for_course
(
course_id
=
course_id
course_id
=
course_id
)
)
return
Response
(
result_set
)
return
Response
(
result_set
)
...
...
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