From ea428273e6ede08c2175d55f54fbf66fb2caf96d Mon Sep 17 00:00:00 2001 From: "E. Kolpakov" Date: Mon, 29 Dec 2014 15:29:30 +0300 Subject: [PATCH] Switched to filtering by response type rather than input type --- common/lib/xmodule/xmodule/capa_module.py | 6 +-- .../xmodule/xmodule/library_content_module.py | 46 +++++++++---------- common/lib/xmodule/xmodule/library_tools.py | 2 +- .../test/acceptance/tests/lms/test_library.py | 6 +-- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 4c7f785c6d..47583d9706 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -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') diff --git a/common/lib/xmodule/xmodule/library_content_module.py b/common/lib/xmodule/xmodule/library_content_module.py index 11d23106f4..d8512bcdbe 100644 --- a/common/lib/xmodule/xmodule/library_content_module.py +++ b/common/lib/xmodule/xmodule/library_content_module.py @@ -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([ diff --git a/common/lib/xmodule/xmodule/library_tools.py b/common/lib/xmodule/xmodule/library_tools.py index d0e6768ed8..3b902622c5 100644 --- a/common/lib/xmodule/xmodule/library_tools.py +++ b/common/lib/xmodule/xmodule/library_tools.py @@ -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 """ diff --git a/common/test/acceptance/tests/lms/test_library.py b/common/test/acceptance/tests/lms/test_library.py index 53b26238c5..cd28f81da2 100644 --- a/common/test/acceptance/tests/lms/test_library.py +++ b/common/test/acceptance/tests/lms/test_library.py @@ -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())