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
fca78b83
Commit
fca78b83
authored
Feb 13, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Relative tolerance, minor clean-up, as per Dave
--HG-- branch : tolerance_bug
parent
a4dc0150
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
courseware/capa/responsetypes.py
+6
-6
No files found.
courseware/capa/responsetypes.py
View file @
fca78b83
...
...
@@ -26,8 +26,8 @@ def compare_with_tolerance(v1, v2, tol):
'''
relative
=
"
%
"
in
tol
if
relative
:
tolerance
=
evaluator
(
dict
(),
dict
(),
tol
[:
-
1
])
*
0.01
tolerance
=
tolerance
*
max
(
abs
(
v1
),
abs
(
v2
))
tolerance
_rel
=
evaluator
(
dict
(),
dict
(),
tol
[:
-
1
])
*
0.01
tolerance
=
tolerance
_rel
*
max
(
abs
(
v1
),
abs
(
v2
))
else
:
tolerance
=
evaluator
(
dict
(),
dict
(),
tol
)
return
abs
(
v1
-
v2
)
<=
tolerance
...
...
@@ -37,9 +37,9 @@ class numericalresponse(object):
self
.
xml
=
xml
self
.
correct_answer
=
contextualize_text
(
xml
.
get
(
'answer'
),
context
)
self
.
correct_answer
=
float
(
self
.
correct_answer
)
self
.
tolerance
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
self
.
tolerance
_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
id
=
xml
.
get
(
'id'
))[
0
]
self
.
tolerance
=
contextualize_text
(
self
.
tolerance
,
context
)
self
.
tolerance
=
contextualize_text
(
self
.
tolerance
_xml
,
context
)
self
.
answer_id
=
xml
.
xpath
(
'//*[@id=$id]//textline/@id'
,
id
=
xml
.
get
(
'id'
))[
0
]
...
...
@@ -89,9 +89,9 @@ class formularesponse(object):
self
.
xml
=
xml
self
.
correct_answer
=
contextualize_text
(
xml
.
get
(
'answer'
),
context
)
self
.
samples
=
contextualize_text
(
xml
.
get
(
'samples'
),
context
)
self
.
tolerance
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
self
.
tolerance
_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
id
=
xml
.
get
(
'id'
))[
0
]
self
.
tolerance
=
contextualize_text
(
self
.
tolerance
,
context
)
self
.
tolerance
=
contextualize_text
(
self
.
tolerance
_xml
,
context
)
self
.
answer_id
=
xml
.
xpath
(
'//*[@id=$id]//textline/@id'
,
id
=
xml
.
get
(
'id'
))[
0
]
self
.
context
=
context
...
...
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