Commit ea428273 by E. Kolpakov

Switched to filtering by response type rather than input type

parent fcbc8446
...@@ -7,7 +7,7 @@ from lxml import etree ...@@ -7,7 +7,7 @@ from lxml import etree
from pkg_resources import resource_string from pkg_resources import resource_string
from .capa_base import CapaMixin, CapaFields, ComplexEncoder from .capa_base import CapaMixin, CapaFields, ComplexEncoder
from capa import inputtypes from capa import responsetypes
from .progress import Progress from .progress import Progress
from xmodule.x_module import XModule, module_attr from xmodule.x_module import XModule, module_attr
from xmodule.raw_module import RawDescriptor from xmodule.raw_module import RawDescriptor
...@@ -178,8 +178,8 @@ class CapaDescriptor(CapaFields, RawDescriptor): ...@@ -178,8 +178,8 @@ class CapaDescriptor(CapaFields, RawDescriptor):
def problem_types(self): def problem_types(self):
""" Low-level problem type introspection for content libraries filtering by problem type """ """ Low-level problem type introspection for content libraries filtering by problem type """
tree = etree.XML(self.data) tree = etree.XML(self.data)
registered_tas = inputtypes.registry.registered_tags() registered_tags = responsetypes.registry.registered_tags()
return set([node.tag for node in tree.iter() if node.tag in registered_tas]) return set([node.tag for node in tree.iter() if node.tag in registered_tags])
# Proxy to CapaModule for access to any of its attributes # Proxy to CapaModule for access to any of its attributes
answer_available = module_attr('answer_available') answer_available = module_attr('answer_available')
......
...@@ -39,30 +39,28 @@ def _get_capa_types(): ...@@ -39,30 +39,28 @@ def _get_capa_types():
Gets capa types tags and labels Gets capa types tags and labels
""" """
capa_types = { capa_types = {
'annotationinput': _('Annotation'), # basic tab
'checkboxgroup': _('Checkbox Group'), 'choiceresponse': _('Checkboxes'),
'checkboxtextgroup': _('Checkbox Text Group'), 'optionresponse': _('Dropdown'),
'chemicalequationinput': _('Chemical Equation'), 'multiplechoiceresponse': _('Multiple Choice'),
'choicegroup': _('Choice Group'), 'truefalseresponse': _('True/False Choice'),
'codeinput': _('Code Input'), 'numericalresponse': _('Numerical Input'),
'crystallography': _('Crystallography'), 'stringresponse': _('Text Input'),
'designprotein2dinput': _('Design Protein 2D'),
'drag_and_drop_input': _('Drag and Drop'), # advanced tab
'editageneinput': _('Edit A Gene'), 'schematicresponse': _('Circuit Schematic Builder'),
'editamoleculeinput': _('Edit A Molecule'), 'customresponse': _('Custom Evaluated Script'),
'filesubmission': _('File Submission'), 'imageresponse': _('Image Mapped Input'),
'formulaequationinput': _('Formula Equation'), 'formularesponse': _('Math Expression Input'),
'imageinput': _('Image'), 'jsmeresponse': _('Molecular Structure'),
'javascriptinput': _('Javascript Input'),
'jsinput': _('JS Input'), # not in "Add Component" menu
'matlabinput': _('Matlab'), 'javascriptresponse': _('Javascript Input'),
'optioninput': _('Select Option'), 'symbolicresponse': _('Symbolic Math Input'),
'radiogroup': _('Radio Group'), 'coderesponse': _('Code Input'),
'radiotextgroup': _('Radio Text Group'), 'externalresponse': _('External Grader'),
'schematic': _('Schematic'), 'annotationresponse': _('Annotation Input'),
'textbox': _('Code Text Input'), 'choicetextresponse': _('Checkboxes With Text Input'),
'textline': _('Text Line'),
'vsepr_input': _('VSEPR'),
} }
return [{'value': ANY_CAPA_TYPE_VALUE, 'display_name': _('Any Type')}] + sorted([ return [{'value': ANY_CAPA_TYPE_VALUE, 'display_name': _('Any Type')}] + sorted([
......
...@@ -104,7 +104,7 @@ class LibraryToolsService(object): ...@@ -104,7 +104,7 @@ class LibraryToolsService(object):
new_libraries = [] new_libraries = []
for library_key, library in libraries: for library_key, library in libraries:
def copy_children_recursively(from_block, filter_problem_type=True): def copy_children_recursively(from_block, filter_problem_type=False):
""" """
Internal method to copy blocks from the library recursively Internal method to copy blocks from the library recursively
""" """
......
...@@ -277,7 +277,7 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase): ...@@ -277,7 +277,7 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
self.assertLessEqual(children_headers, self._problem_headers) self.assertLessEqual(children_headers, self._problem_headers)
# Choice group test # Choice group test
children_headers = self._set_library_content_settings(count=1, capa_type="Choice Group") children_headers = self._set_library_content_settings(count=1, capa_type="Multiple Choice")
self.assertEqual(len(children_headers), 1) self.assertEqual(len(children_headers), 1)
self.assertLessEqual( self.assertLessEqual(
children_headers, children_headers,
...@@ -285,7 +285,7 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase): ...@@ -285,7 +285,7 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
) )
# Choice group test # Choice group test
children_headers = self._set_library_content_settings(count=2, capa_type="Select Option") children_headers = self._set_library_content_settings(count=2, capa_type="Dropdown")
self.assertEqual(len(children_headers), 2) self.assertEqual(len(children_headers), 2)
self.assertLessEqual( self.assertLessEqual(
children_headers, children_headers,
...@@ -293,5 +293,5 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase): ...@@ -293,5 +293,5 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
) )
# Missing problem type test # Missing problem type test
children_headers = self._set_library_content_settings(count=2, capa_type="Matlab") children_headers = self._set_library_content_settings(count=2, capa_type="Custom Evaluated Script")
self.assertEqual(children_headers, set()) self.assertEqual(children_headers, set())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment