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
65ec8538
Commit
65ec8538
authored
Dec 15, 2015
by
John Eskew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10698 from edx/jeskew/TNL-3795_fix
Protect against divide by zero in DataDog event.
parents
34b01bf8
5382c86c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
common/lib/xmodule/xmodule/capa_base.py
+5
-4
common/lib/xmodule/xmodule/tests/test_capa_module.py
+14
-0
No files found.
common/lib/xmodule/xmodule/capa_base.py
View file @
65ec8538
...
...
@@ -1116,10 +1116,11 @@ class CapaMixin(CapaFields):
if
dog_stats_api
:
dog_stats_api
.
increment
(
metric_name
(
'checks'
),
tags
=
[
u'result:success'
])
dog_stats_api
.
histogram
(
metric_name
(
'correct_pct'
),
float
(
published_grade
[
'grade'
])
/
published_grade
[
'max_grade'
],
)
if
published_grade
[
'max_grade'
]
!=
0
:
dog_stats_api
.
histogram
(
metric_name
(
'correct_pct'
),
float
(
published_grade
[
'grade'
])
/
published_grade
[
'max_grade'
],
)
dog_stats_api
.
histogram
(
metric_name
(
'attempts'
),
self
.
attempts
,
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
65ec8538
...
...
@@ -731,6 +731,20 @@ class CapaModuleTest(unittest.TestCase):
# Expect an AJAX alert message in 'success'
self
.
assertIn
(
error_msg
,
result
[
'success'
])
def
test_check_problem_zero_max_grade
(
self
):
"""
Test that a capa problem with a max grade of zero doesn't generate an error.
"""
# Create the module
module
=
CapaFactory
.
create
(
attempts
=
1
)
# Override the problem score to have a total of zero.
module
.
lcp
.
get_score
=
lambda
:
{
'score'
:
0
,
'total'
:
0
}
# Check the problem
get_request_dict
=
{
CapaFactory
.
input_key
():
'3.14'
}
module
.
check_problem
(
get_request_dict
)
def
test_check_problem_error_nonascii
(
self
):
# Try each exception that capa_module should handle
...
...
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