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
e074693f
Commit
e074693f
authored
Jul 25, 2017
by
Tyler Hallada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to match implementation of GradesService
parent
a76cbb49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
edx_proctoring/api.py
+7
-4
edx_proctoring/tests/test_api.py
+8
-5
edx_proctoring/tests/test_services.py
+6
-3
No files found.
edx_proctoring/api.py
View file @
e074693f
...
...
@@ -58,7 +58,7 @@ SHOW_EXPIRY_MESSAGE_DURATION = 1 * 60 # duration within which expiry message is
APPROVED_STATUS
=
'approved'
REJECTED_GRADE_OVERRIDE_
SCORE
=
0
REJECTED_GRADE_OVERRIDE_
EARNED
=
0.
0
def
create_exam
(
course_id
,
content_id
,
exam_name
,
time_limit_mins
,
due_date
=
None
,
...
...
@@ -897,11 +897,13 @@ def update_attempt_status(exam_id, user_id, to_status,
'Overriding exam subsection grade for '
'user_id {user_id} on {course_id} for '
'content_id {content_id}. Override '
'score: {score}'
.
format
(
'earned_all: {earned_all}, '
'earned_graded: {earned_graded}.'
.
format
(
user_id
=
exam_attempt_obj
.
user_id
,
course_id
=
exam
[
'course_id'
],
content_id
=
exam_attempt_obj
.
proctored_exam
.
content_id
,
score
=
REJECTED_GRADE_OVERRIDE_SCORE
earned_all
=
REJECTED_GRADE_OVERRIDE_EARNED
,
earned_graded
=
REJECTED_GRADE_OVERRIDE_EARNED
)
)
log
.
info
(
log_msg
)
...
...
@@ -910,7 +912,8 @@ def update_attempt_status(exam_id, user_id, to_status,
user_id
=
exam_attempt_obj
.
user_id
,
course_key_or_id
=
exam
[
'course_id'
],
subsection
=
exam_attempt_obj
.
proctored_exam
.
content_id
,
score
=
REJECTED_GRADE_OVERRIDE_SCORE
earned_all
=
REJECTED_GRADE_OVERRIDE_EARNED
,
earned_graded
=
REJECTED_GRADE_OVERRIDE_EARNED
)
# call service to get course name.
...
...
edx_proctoring/tests/test_api.py
View file @
e074693f
...
...
@@ -928,11 +928,14 @@ class ProctoredExamApiTests(ProctoredExamTestCase):
)
grades_service
=
get_runtime_service
(
'grades'
)
grades_status
=
grades_service
.
get_subsection_grade
(
user_id
=
self
.
user
.
id
,
course_key_or_id
=
exam_attempt
.
proctored_exam
.
course_id
,
subsection
=
exam_attempt
.
proctored_exam
.
content_id
)
self
.
assertEqual
(
grades_status
,
0
)
grades
=
grades_service
.
get_subsection_grade
(
user_id
=
self
.
user
.
id
,
course_key_or_id
=
exam_attempt
.
proctored_exam
.
course_id
,
subsection
=
exam_attempt
.
proctored_exam
.
content_id
)
self
.
assertEqual
(
grades
,
{
'earned_all'
:
0.0
,
'earned_graded'
:
0.0
})
@ddt.data
(
(
ProctoredExamStudentAttemptStatus
.
declined
,
ProctoredExamStudentAttemptStatus
.
eligible
),
...
...
edx_proctoring/tests/test_services.py
View file @
e074693f
...
...
@@ -187,6 +187,9 @@ class MockGradesService(object):
"""Returns entered grade override for key (user_id + course_key + subsection) or None"""
return
self
.
grades
.
get
(
str
(
user_id
)
+
str
(
course_key_or_id
)
+
str
(
subsection
))
def
override_subsection_grade
(
self
,
user_id
,
course_key_or_id
,
subsection
,
score
):
"""Sets grade override score for key (user_id + course_key + subsection)"""
self
.
grades
[
str
(
user_id
)
+
str
(
course_key_or_id
)
+
str
(
subsection
)]
=
score
def
override_subsection_grade
(
self
,
user_id
,
course_key_or_id
,
subsection
,
earned_all
=
None
,
earned_graded
=
None
):
"""Sets grade override earned points for key (user_id + course_key + subsection)"""
self
.
grades
[
str
(
user_id
)
+
str
(
course_key_or_id
)
+
str
(
subsection
)]
=
{
'earned_all'
:
earned_all
,
'earned_graded'
:
earned_graded
}
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