Switched to filtering by response type rather than input type
This commit is contained in:
@@ -7,7 +7,7 @@ from lxml import etree
|
||||
from pkg_resources import resource_string
|
||||
|
||||
from .capa_base import CapaMixin, CapaFields, ComplexEncoder
|
||||
from capa import inputtypes
|
||||
from capa import responsetypes
|
||||
from .progress import Progress
|
||||
from xmodule.x_module import XModule, module_attr
|
||||
from xmodule.raw_module import RawDescriptor
|
||||
@@ -178,8 +178,8 @@ class CapaDescriptor(CapaFields, RawDescriptor):
|
||||
def problem_types(self):
|
||||
""" Low-level problem type introspection for content libraries filtering by problem type """
|
||||
tree = etree.XML(self.data)
|
||||
registered_tas = inputtypes.registry.registered_tags()
|
||||
return set([node.tag for node in tree.iter() if node.tag in registered_tas])
|
||||
registered_tags = responsetypes.registry.registered_tags()
|
||||
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
|
||||
answer_available = module_attr('answer_available')
|
||||
|
||||
@@ -39,30 +39,28 @@ def _get_capa_types():
|
||||
Gets capa types tags and labels
|
||||
"""
|
||||
capa_types = {
|
||||
'annotationinput': _('Annotation'),
|
||||
'checkboxgroup': _('Checkbox Group'),
|
||||
'checkboxtextgroup': _('Checkbox Text Group'),
|
||||
'chemicalequationinput': _('Chemical Equation'),
|
||||
'choicegroup': _('Choice Group'),
|
||||
'codeinput': _('Code Input'),
|
||||
'crystallography': _('Crystallography'),
|
||||
'designprotein2dinput': _('Design Protein 2D'),
|
||||
'drag_and_drop_input': _('Drag and Drop'),
|
||||
'editageneinput': _('Edit A Gene'),
|
||||
'editamoleculeinput': _('Edit A Molecule'),
|
||||
'filesubmission': _('File Submission'),
|
||||
'formulaequationinput': _('Formula Equation'),
|
||||
'imageinput': _('Image'),
|
||||
'javascriptinput': _('Javascript Input'),
|
||||
'jsinput': _('JS Input'),
|
||||
'matlabinput': _('Matlab'),
|
||||
'optioninput': _('Select Option'),
|
||||
'radiogroup': _('Radio Group'),
|
||||
'radiotextgroup': _('Radio Text Group'),
|
||||
'schematic': _('Schematic'),
|
||||
'textbox': _('Code Text Input'),
|
||||
'textline': _('Text Line'),
|
||||
'vsepr_input': _('VSEPR'),
|
||||
# basic tab
|
||||
'choiceresponse': _('Checkboxes'),
|
||||
'optionresponse': _('Dropdown'),
|
||||
'multiplechoiceresponse': _('Multiple Choice'),
|
||||
'truefalseresponse': _('True/False Choice'),
|
||||
'numericalresponse': _('Numerical Input'),
|
||||
'stringresponse': _('Text Input'),
|
||||
|
||||
# advanced tab
|
||||
'schematicresponse': _('Circuit Schematic Builder'),
|
||||
'customresponse': _('Custom Evaluated Script'),
|
||||
'imageresponse': _('Image Mapped Input'),
|
||||
'formularesponse': _('Math Expression Input'),
|
||||
'jsmeresponse': _('Molecular Structure'),
|
||||
|
||||
# not in "Add Component" menu
|
||||
'javascriptresponse': _('Javascript Input'),
|
||||
'symbolicresponse': _('Symbolic Math Input'),
|
||||
'coderesponse': _('Code Input'),
|
||||
'externalresponse': _('External Grader'),
|
||||
'annotationresponse': _('Annotation Input'),
|
||||
'choicetextresponse': _('Checkboxes With Text Input'),
|
||||
}
|
||||
|
||||
return [{'value': ANY_CAPA_TYPE_VALUE, 'display_name': _('Any Type')}] + sorted([
|
||||
|
||||
@@ -104,7 +104,7 @@ class LibraryToolsService(object):
|
||||
new_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
|
||||
"""
|
||||
|
||||
@@ -277,7 +277,7 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
|
||||
self.assertLessEqual(children_headers, self._problem_headers)
|
||||
|
||||
# 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.assertLessEqual(
|
||||
children_headers,
|
||||
@@ -285,7 +285,7 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
|
||||
)
|
||||
|
||||
# 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.assertLessEqual(
|
||||
children_headers,
|
||||
@@ -293,5 +293,5 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
|
||||
)
|
||||
|
||||
# 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())
|
||||
|
||||
Reference in New Issue
Block a user