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
c397495e
Commit
c397495e
authored
Nov 10, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed null answer in checkbox problem as incorrect.
TNL-765
parent
9688b868
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
common/lib/capa/capa/responsetypes.py
+2
-1
common/lib/capa/capa/tests/test_responsetypes.py
+11
-0
No files found.
common/lib/capa/capa/responsetypes.py
View file @
c397495e
...
@@ -715,12 +715,13 @@ class ChoiceResponse(LoncapaResponse):
...
@@ -715,12 +715,13 @@ class ChoiceResponse(LoncapaResponse):
if
not
isinstance
(
student_answer
,
list
):
if
not
isinstance
(
student_answer
,
list
):
student_answer
=
[
student_answer
]
student_answer
=
[
student_answer
]
no_empty_answer
=
student_answer
!=
[]
student_answer
=
set
(
student_answer
)
student_answer
=
set
(
student_answer
)
required_selected
=
len
(
self
.
correct_choices
-
student_answer
)
==
0
required_selected
=
len
(
self
.
correct_choices
-
student_answer
)
==
0
no_extra_selected
=
len
(
student_answer
-
self
.
correct_choices
)
==
0
no_extra_selected
=
len
(
student_answer
-
self
.
correct_choices
)
==
0
correct
=
required_selected
&
no_extra_selected
correct
=
required_selected
&
no_extra_selected
&
no_empty_answer
if
correct
:
if
correct
:
return
CorrectMap
(
self
.
answer_id
,
'correct'
)
return
CorrectMap
(
self
.
answer_id
,
'correct'
)
...
...
common/lib/capa/capa/tests/test_responsetypes.py
View file @
c397495e
...
@@ -1075,6 +1075,17 @@ class ChoiceResponseTest(ResponseTest):
...
@@ -1075,6 +1075,17 @@ class ChoiceResponseTest(ResponseTest):
# No choice 3 exists --> mark incorrect
# No choice 3 exists --> mark incorrect
self
.
assert_grade
(
problem
,
'choice_3'
,
'incorrect'
)
self
.
assert_grade
(
problem
,
'choice_3'
,
'incorrect'
)
def
test_grade_with_no_checkbox_selected
(
self
):
"""
Test that answer marked as incorrect if no checkbox selected.
"""
problem
=
self
.
build_problem
(
choice_type
=
'checkbox'
,
choices
=
[
False
,
False
,
False
]
)
correct_map
=
problem
.
grade_answers
({})
self
.
assertEqual
(
correct_map
.
get_correctness
(
'1_2_1'
),
'incorrect'
)
class
JavascriptResponseTest
(
ResponseTest
):
class
JavascriptResponseTest
(
ResponseTest
):
from
capa.tests.response_xml_factory
import
JavascriptResponseXMLFactory
from
capa.tests.response_xml_factory
import
JavascriptResponseXMLFactory
...
...
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