Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
c5e0ce50
Commit
c5e0ce50
authored
Oct 12, 2017
by
Nimisha Asthagiri
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16218 from edx/naa/fix-grade-zero-error
Grades: Fix ZeroDivisionError
parents
17d93360
811ab640
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
lms/djangoapps/grades/subsection_grade.py
+3
-0
lms/djangoapps/grades/tests/test_subsection_grade.py
+10
-0
No files found.
lms/djangoapps/grades/subsection_grade.py
View file @
c5e0ce50
...
...
@@ -141,7 +141,10 @@ class NonZeroSubsectionGrade(SubsectionGradeBase):
@property
def
percent_graded
(
self
):
if
self
.
graded_total
.
possible
>
0
:
return
self
.
graded_total
.
earned
/
self
.
graded_total
.
possible
else
:
return
0.0
@staticmethod
def
_compute_block_score
(
...
...
lms/djangoapps/grades/tests/test_subsection_grade.py
View file @
c5e0ce50
...
...
@@ -36,3 +36,13 @@ class SubsectionGradeTest(GradeTestBase):
read_grade
.
all_total
.
first_attempted
=
created_grade
.
all_total
.
first_attempted
=
None
self
.
assertEqual
(
created_grade
.
all_total
,
read_grade
.
all_total
)
self
.
assertEqual
(
created_grade
.
percent_graded
,
0.5
)
def
test_zero
(
self
):
with
mock_get_score
(
1
,
0
):
grade
=
CreateSubsectionGrade
(
self
.
sequence
,
self
.
course_structure
,
self
.
subsection_grade_factory
.
_submissions_scores
,
self
.
subsection_grade_factory
.
_csm_scores
,
)
self
.
assertEqual
(
grade
.
percent_graded
,
0.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