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
4d880db1
Commit
4d880db1
authored
Jul 04, 2013
by
RobertMarks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated behavior for split_answer_dict, get_score, and check_student_inputs (responsetypes.py)
parent
46ae2f9c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
19 deletions
+18
-19
common/lib/capa/capa/inputtypes.py
+9
-10
common/lib/capa/capa/responsetypes.py
+0
-2
common/lib/capa/capa/tests/response_xml_factory.py
+3
-3
common/lib/capa/capa/tests/test_responsetypes.py
+0
-0
common/lib/xmodule/xmodule/capa_module.py
+4
-3
lms/djangoapps/courseware/features/problems_setup.py
+2
-1
No files found.
common/lib/capa/capa/inputtypes.py
View file @
4d880db1
...
...
@@ -460,10 +460,10 @@ class JSInput(InputTypeBase):
DO NOT USE! HAS NOT BEEN TESTED BEYOND 700X PROBLEMS, AND MAY CHANGE IN
BACKWARDS-INCOMPATIBLE WAYS.
Inputtype for general javascript inputs. Intended to be used with
customresponse.
customresponse.
Loads in a sandboxed iframe to help prevent css and js conflicts between
frame and top-level window.
frame and top-level window.
iframe sandbox whitelist:
- allow-scripts
- allow-popups
...
...
@@ -474,9 +474,9 @@ class JSInput(InputTypeBase):
window elements.
Example:
<jsinput html_file="/static/test.html"
gradefn="grade"
height="500"
<jsinput html_file="/static/test.html"
gradefn="grade"
height="500"
width="400"/>
See the documentation in the /doc/public folder for more information.
...
...
@@ -500,7 +500,7 @@ class JSInput(InputTypeBase):
Attribute
(
'width'
,
"400"
),
# iframe width
Attribute
(
'height'
,
"300"
)]
# iframe height
def
_extra_context
(
self
):
context
=
{
...
...
@@ -510,11 +510,12 @@ class JSInput(InputTypeBase):
return
context
registry
.
register
(
JSInput
)
#-----------------------------------------------------------------------------
class
TextLine
(
InputTypeBase
):
"""
A text line input. Can do math preview if "math"="1" is specified.
...
...
@@ -1373,8 +1374,6 @@ registry.register(AnnotationInput)
class
ChoiceTextGroup
(
InputTypeBase
):
"""
Groups of radiobutton/checkboxes with text inputs.
Allows for a "not enough information" option to be added
to problems with numerical answers.
Examples:
RadioButton problem
...
...
common/lib/capa/capa/responsetypes.py
View file @
4d880db1
...
...
@@ -2256,7 +2256,6 @@ class ChoiceTextResponse(LoncapaResponse):
binary_choices
,
numtolerance_inputs
=
self
.
_split_answers_dict
(
answer_dict
)
# Check the binary choices first.
choices_correct
=
self
.
_check_student_choices
(
binary_choices
)
inputs_correct
=
True
inputs_correct
=
self
.
_check_student_inputs
(
numtolerance_inputs
)
# Only return correct if the student got both the binary
# and numtolerance_inputs are correct
...
...
@@ -2376,7 +2375,6 @@ class ChoiceTextResponse(LoncapaResponse):
Returns True if and only if all student inputs are correct.
"""
inputs_correct
=
True
for
answer_name
,
answer_value
in
numtolerance_inputs
.
iteritems
():
# If `self.corrrect_inputs` does not contain an entry for
...
...
common/lib/capa/capa/tests/response_xml_factory.py
View file @
4d880db1
...
...
@@ -857,15 +857,15 @@ class ChoiceTextResponseXMLFactory(ResponseXMLFactory):
choice_element
.
set
(
"correct"
,
correct
)
choice_element
.
text
=
text
for
inp
in
inputs
:
# Add all of the inputs as children of this
element
# Add all of the inputs as children of this
choice
choice_element
.
append
(
inp
)
return
choice_element
def
_create_numtolerance_input_element
(
self
,
params
):
"""
Creates a <numtolerance_input/>
element with optionally
specified tolerance and answer.
Creates a <numtolerance_input/>
or <decoy_input/> element with
optionally
specified tolerance and answer.
"""
answer
=
params
[
'answer'
]
if
'answer'
in
params
else
None
# If there is not an answer specified, Then create a <decoy_input/>
...
...
common/lib/capa/capa/tests/test_responsetypes.py
View file @
4d880db1
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/capa_module.py
View file @
4d880db1
...
...
@@ -820,10 +820,11 @@ class CapaModule(CapaFields, XModule):
elif
is_dict_key
:
try
:
val
=
json
.
loads
(
data
[
key
])
# If the submission wasn't deserializable, raise an error.
except
(
KeyError
,
ValueError
):
# Send this information along to be reported by
# The grading method
val
=
{
"error"
:
"error"
}
raise
ValueError
(
u"Invalid submission: {val} for {key}"
.
format
(
val
=
data
[
key
],
key
=
key
)
)
else
:
val
=
data
[
key
]
...
...
lms/djangoapps/courseware/features/problems_setup.py
View file @
4d880db1
...
...
@@ -388,8 +388,9 @@ def assert_choicetext_values(problem_type, choices, expected_values):
Asserts that only the given choices are checked, and given
text fields have a desired value
"""
# Names of the radio buttons or checkboxes
all_choices
=
[
'choiceinput_0bc'
,
'choiceinput_1bc'
]
# Names of the numtolerance_inputs
all_inputs
=
[
"choiceinput_0_numtolerance_input_0"
,
"choiceinput_1_numtolerance_input_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