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
e724f625
Commit
e724f625
authored
Oct 05, 2015
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #188 from edx/cdodge/hotfix-2015-10-05
Cdodge/hotfix 2015 10 05
parents
30f75ba7
6d03609c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
11 deletions
+46
-11
edx_proctoring/api.py
+6
-6
edx_proctoring/models.py
+10
-4
edx_proctoring/tests/test_api.py
+5
-0
edx_proctoring/tests/test_models.py
+24
-0
setup.py
+1
-1
No files found.
edx_proctoring/api.py
View file @
e724f625
...
@@ -1124,12 +1124,12 @@ def get_student_view(user_id, course_id, content_id,
...
@@ -1124,12 +1124,12 @@ def get_student_view(user_id, course_id, content_id,
# so we can mark it as declined
# so we can mark it as declined
create_exam_attempt
(
exam_id
,
user_id
)
create_exam_attempt
(
exam_id
,
user_id
)
update_attempt_status
(
update_attempt_status
(
exam_id
,
exam_id
,
user_id
,
user_id
,
ProctoredExamStudentAttemptStatus
.
declined
,
ProctoredExamStudentAttemptStatus
.
declined
,
raise_if_not_found
=
False
raise_if_not_found
=
False
)
)
# don't override context, let the courseware show
# don't override context, let the courseware show
return
None
return
None
...
...
edx_proctoring/models.py
View file @
e724f625
...
@@ -518,10 +518,16 @@ class ProctoredExamStudentAttemptHistory(TimeStampedModel):
...
@@ -518,10 +518,16 @@ class ProctoredExamStudentAttemptHistory(TimeStampedModel):
Returns the Student Exam Attempt object if found
Returns the Student Exam Attempt object if found
else Returns None.
else Returns None.
"""
"""
try
:
# NOTE: compared to the ProctoredExamAttempt table
exam_attempt_obj
=
cls
.
objects
.
get
(
attempt_code
=
attempt_code
)
# we can have multiple rows with the same attempt_code
except
ObjectDoesNotExist
:
# pylint: disable=no-member
# So, just return the first one (most recent) if
exam_attempt_obj
=
None
# there are any
exam_attempt_obj
=
None
items
=
cls
.
objects
.
filter
(
attempt_code
=
attempt_code
)
.
order_by
(
"-created"
)
if
items
:
exam_attempt_obj
=
items
[
0
]
return
exam_attempt_obj
return
exam_attempt_obj
class
Meta
:
class
Meta
:
...
...
edx_proctoring/tests/test_api.py
View file @
e724f625
...
@@ -726,6 +726,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -726,6 +726,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
@ddt.data
(
@ddt.data
(
(
'reverification'
,
None
,
True
,
True
,
False
),
(
'reverification'
,
None
,
True
,
True
,
False
),
(
'reverification'
,
'failed'
,
False
,
False
,
True
),
(
'reverification'
,
'failed'
,
False
,
False
,
True
),
(
'reverification'
,
'failed'
,
False
,
True
,
False
),
(
'reverification'
,
'satisfied'
,
True
,
True
,
False
),
(
'reverification'
,
'satisfied'
,
True
,
True
,
False
),
(
'grade'
,
'failed'
,
True
,
False
,
False
)
(
'grade'
,
'failed'
,
True
,
False
,
False
)
)
)
...
@@ -775,6 +776,10 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -775,6 +776,10 @@ class ProctoredExamApiTests(LoggedInTestCase):
if
mark_as_declined
:
if
mark_as_declined
:
attempt
=
get_exam_attempt
(
self
.
proctored_exam_id
,
self
.
user_id
)
attempt
=
get_exam_attempt
(
self
.
proctored_exam_id
,
self
.
user_id
)
self
.
assertEqual
(
attempt
[
'status'
],
ProctoredExamStudentAttemptStatus
.
declined
)
self
.
assertEqual
(
attempt
[
'status'
],
ProctoredExamStudentAttemptStatus
.
declined
)
else
:
attempt
=
get_exam_attempt
(
self
.
proctored_exam_id
,
self
.
user_id
)
if
attempt
:
self
.
assertNotEqual
(
attempt
[
'status'
],
ProctoredExamStudentAttemptStatus
.
declined
)
def
test_student_view_non_student
(
self
):
def
test_student_view_non_student
(
self
):
"""
"""
...
...
edx_proctoring/tests/test_models.py
View file @
e724f625
...
@@ -150,6 +150,30 @@ class ProctoredExamStudentAttemptTests(LoggedInTestCase):
...
@@ -150,6 +150,30 @@ class ProctoredExamStudentAttemptTests(LoggedInTestCase):
attempt_history
=
ProctoredExamStudentAttemptHistory
.
objects
.
filter
(
user_id
=
1
)
attempt_history
=
ProctoredExamStudentAttemptHistory
.
objects
.
filter
(
user_id
=
1
)
self
.
assertEqual
(
len
(
attempt_history
),
1
)
self
.
assertEqual
(
len
(
attempt_history
),
1
)
# make sure we can ready it back with helper class method
deleted_item
=
ProctoredExamStudentAttemptHistory
.
get_exam_attempt_by_code
(
"123456"
)
self
.
assertEqual
(
deleted_item
.
student_name
,
"John. D"
)
# re-create and delete again using same attempt_cde
attempt
=
ProctoredExamStudentAttempt
.
objects
.
create
(
proctored_exam_id
=
proctored_exam
.
id
,
user_id
=
1
,
student_name
=
"John. D Updated"
,
allowed_time_limit_mins
=
10
,
attempt_code
=
"123456"
,
taking_as_proctored
=
True
,
is_sample_attempt
=
True
,
external_id
=
1
)
attempt
.
delete_exam_attempt
()
attempt_history
=
ProctoredExamStudentAttemptHistory
.
objects
.
filter
(
user_id
=
1
)
self
.
assertEqual
(
len
(
attempt_history
),
2
)
deleted_item
=
ProctoredExamStudentAttemptHistory
.
get_exam_attempt_by_code
(
"123456"
)
self
.
assertEqual
(
deleted_item
.
student_name
,
"John. D Updated"
)
def
test_get_exam_attempts
(
self
):
def
test_get_exam_attempts
(
self
):
"""
"""
Test to get all the exam attempts for a course
Test to get all the exam attempts for a course
...
...
setup.py
View file @
e724f625
...
@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
...
@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup
(
setup
(
name
=
'edx-proctoring'
,
name
=
'edx-proctoring'
,
version
=
'0.9.1
4
'
,
version
=
'0.9.1
6
'
,
description
=
'Proctoring subsystem for Open edX'
,
description
=
'Proctoring subsystem for Open edX'
,
long_description
=
open
(
'README.md'
)
.
read
(),
long_description
=
open
(
'README.md'
)
.
read
(),
author
=
'edX'
,
author
=
'edX'
,
...
...
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