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
50f6ca89
Commit
50f6ca89
authored
Jul 24, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9045 from edx/peter-fogg/fix-true-false-response
Fix TrueFalse responses with single answers.
parents
b7a74f57
95eccf6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
common/lib/capa/capa/responsetypes.py
+4
-2
common/lib/capa/capa/tests/test_responsetypes.py
+5
-0
No files found.
common/lib/capa/capa/responsetypes.py
View file @
50f6ca89
...
...
@@ -1323,9 +1323,11 @@ class TrueFalseResponse(MultipleChoiceResponse):
def
get_score
(
self
,
student_answers
):
correct
=
set
(
self
.
correct_choices
)
answers
=
set
(
student_answers
.
get
(
self
.
answer_id
,
[]))
answers
=
student_answers
.
get
(
self
.
answer_id
,
[])
if
not
isinstance
(
answers
,
list
):
answers
=
[
answers
]
if
correct
==
answers
:
if
correct
==
set
(
answers
)
:
return
CorrectMap
(
self
.
answer_id
,
'correct'
)
return
CorrectMap
(
self
.
answer_id
,
'incorrect'
)
...
...
common/lib/capa/capa/tests/test_responsetypes.py
View file @
50f6ca89
...
...
@@ -151,6 +151,11 @@ class TrueFalseResponseTest(ResponseTest):
self
.
assert_grade
(
problem
,
'choice_foil_4'
,
'incorrect'
)
self
.
assert_grade
(
problem
,
'not_a_choice'
,
'incorrect'
)
def
test_single_correct_response
(
self
):
problem
=
self
.
build_problem
(
choices
=
[
True
,
False
])
self
.
assert_grade
(
problem
,
'choice_0'
,
'correct'
)
self
.
assert_grade
(
problem
,
[
'choice_0'
],
'correct'
)
class
ImageResponseTest
(
ResponseTest
):
xml_factory_class
=
ImageResponseXMLFactory
...
...
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