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
edx
edx-proctoring
Commits
407544d6
Commit
407544d6
authored
Sep 22, 2017
by
noraiz-anwar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exam violation report with deleted exam attempt
parent
fc99bf4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
7 deletions
+41
-7
edx_proctoring/api.py
+7
-7
edx_proctoring/tests/test_api.py
+34
-0
No files found.
edx_proctoring/api.py
View file @
407544d6
...
@@ -1981,15 +1981,15 @@ def get_exam_violation_report(course_id, include_practice_exams=False):
...
@@ -1981,15 +1981,15 @@ def get_exam_violation_report(course_id, include_practice_exams=False):
for
review
in
reviews
:
for
review
in
reviews
:
attempt_code
=
review
.
attempt_code
attempt_code
=
review
.
attempt_code
if
attempt_code
in
attempts_by_code
:
attempts_by_code
[
attempt_code
][
'review_status'
]
=
review
.
review_status
attempts_by_code
[
attempt_code
][
'review_status'
]
=
review
.
review_status
for
comment
in
review
.
proctoredexamsoftwaresecurecomment_set
.
all
():
comments_key
=
'{status} Comments'
.
format
(
status
=
comment
.
status
)
for
comment
in
review
.
proctoredexamsoftwaresecurecomment_set
.
all
()
:
if
comments_key
not
in
attempts_by_code
[
attempt_code
]
:
comments_key
=
'{status} Comments'
.
format
(
status
=
comment
.
status
)
attempts_by_code
[
attempt_code
][
comments_key
]
=
[]
if
comments_key
not
in
attempts_by_code
[
attempt_code
]:
attempts_by_code
[
attempt_code
][
comments_key
]
.
append
(
comment
.
comment
)
attempts_by_code
[
attempt_code
][
comments_key
]
=
[]
attempts_by_code
[
attempt_code
][
comments_key
]
.
append
(
comment
.
comment
)
return
sorted
(
attempts_by_code
.
values
(),
key
=
lambda
a
:
a
[
'exam_name'
])
return
sorted
(
attempts_by_code
.
values
(),
key
=
lambda
a
:
a
[
'exam_name'
])
edx_proctoring/tests/test_api.py
View file @
407544d6
...
@@ -1817,3 +1817,37 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
...
@@ -1817,3 +1817,37 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
self
.
assertEqual
(
report
[
1
][
'review_status'
],
'Clean'
)
self
.
assertEqual
(
report
[
1
][
'review_status'
],
'Clean'
)
self
.
assertIsNone
(
report
[
0
][
'review_status'
])
self
.
assertIsNone
(
report
[
0
][
'review_status'
])
def
test_get_exam_violation_report_with_deleted_exam_attempt
(
self
):
"""
Tests that get_exam_violation_report does not fail in scenerio
where an exam attempt does not exist for related review.
"""
test_exam_id
=
create_exam
(
course_id
=
self
.
course_id
,
content_id
=
'test_content_1'
,
exam_name
=
'test_exam'
,
time_limit_mins
=
self
.
default_time_limit
)
test_attempt_id
=
create_exam_attempt
(
exam_id
=
test_exam_id
,
user_id
=
self
.
user_id
)
exam1_attempt
=
ProctoredExamStudentAttempt
.
objects
.
get_exam_attempt_by_id
(
test_attempt_id
)
ProctoredExamSoftwareSecureReview
.
objects
.
create
(
exam
=
ProctoredExam
.
get_exam_by_id
(
test_exam_id
),
attempt_code
=
exam1_attempt
.
attempt_code
,
review_status
=
"Suspicious"
)
# exam attempt is deleted but corresponding review instance exists.
exam1_attempt
.
delete
()
report
=
get_exam_violation_report
(
self
.
course_id
)
# call to get_exam_violation_report did not fail. Assert that report is empty as
# the only exam atempt was deleted.
self
.
assertEqual
(
len
(
report
),
0
)
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