Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
612fb259
Unverified
Commit
612fb259
authored
7 years ago
by
Noraiz Anwar
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #17381 from edx/noraiz/EDUCATOR-2228
Clean grade sevice
parents
0b9cf783
d56bd580
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/grades/services.py
+5
-1
5 additions, 1 deletion
lms/djangoapps/grades/services.py
lms/djangoapps/grades/tests/test_services.py
+19
-0
19 additions, 0 deletions
lms/djangoapps/grades/tests/test_services.py
with
24 additions
and
1 deletion
lms/djangoapps/grades/services.py
+
5
−
1
View file @
612fb259
...
...
@@ -105,7 +105,11 @@ class GradesService(object):
course_key
=
_get_key
(
course_key_or_id
,
CourseKey
)
usage_key
=
_get_key
(
usage_key_or_id
,
UsageKey
)
override
=
self
.
get_subsection_grade_override
(
user_id
,
course_key
,
usage_key
)
try
:
override
=
self
.
get_subsection_grade_override
(
user_id
,
course_key
,
usage_key
)
except
PersistentSubsectionGrade
.
DoesNotExist
:
return
# Older rejected exam attempts that transition to verified might not have an override created
if
override
is
not
None
:
override
.
delete
()
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/grades/tests/test_services.py
+
19
−
0
View file @
612fb259
...
...
@@ -217,6 +217,25 @@ class GradesServiceTests(ModuleStoreTestCase):
)
)
@freeze_time
(
'
2018-01-01
'
)
def
test_undo_override_subsection_grade_without_grade
(
self
):
"""
Test exception handling of `undo_override_subsection_grade` when PersistentSubsectionGrade
does not exist.
"""
self
.
grade
.
delete
()
try
:
self
.
service
.
undo_override_subsection_grade
(
user_id
=
self
.
user
.
id
,
course_key_or_id
=
self
.
course
.
id
,
usage_key_or_id
=
self
.
subsection
.
location
,
)
except
PersistentSubsectionGrade
.
DoesNotExist
:
assert
False
,
'
Exception raised unexpectedly
'
self
.
assertFalse
(
self
.
mock_signal
.
called
)
def
test_should_override_grade_on_rejected_exam
(
self
):
self
.
assertTrue
(
self
.
service
.
should_override_grade_on_rejected_exam
(
'
course-v1:edX+DemoX+Demo_Course
'
))
self
.
mock_waffle_flags
.
return_value
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment