class SplitTestFields(object): """Fields needed for split test module""" has_children = True display_name = String( display_name="Display Name", help= "This name appears in the horizontal navigation at the top of the page.", scope=Scope.settings, default="Experiment Block") user_partition_id = Integer( help="Which user partition is used for this test", scope=Scope.content) # group_id is an int # child is a serialized UsageId (aka Location). This child # location needs to actually match one of the children of this # Block. (expected invariant that we'll need to test, and handle # authoring tools that mess this up) # TODO: is there a way to add some validation around this, to # be run on course load or in studio or .... group_id_to_child = ReferenceValueDict( help="Which child module students in a particular group_id should see", scope=Scope.content)
class SplitTestFields(object): """Fields needed for split test module""" has_children = True # All available user partitions (with value and display name). This is updated each time # editable_metadata_fields is called. user_partition_values = [] # Default value used for user_partition_id no_partition_selected = {'display_name': _("Not Selected"), 'value': -1} @staticmethod def build_partition_values(all_user_partitions, selected_user_partition): """ This helper method builds up the user_partition values that will be passed to the Studio editor """ SplitTestFields.user_partition_values = [] # Add "No selection" value if there is not a valid selected user partition. if not selected_user_partition: SplitTestFields.user_partition_values.append(SplitTestFields.no_partition_selected) for user_partition in all_user_partitions: SplitTestFields.user_partition_values.append({"display_name": user_partition.name, "value": user_partition.id}) return SplitTestFields.user_partition_values display_name = String( display_name=_("Display Name"), help=_("This name is used for organizing your course content, but is not shown to students."), scope=Scope.settings, default=_("Content Experiment") ) # Specified here so we can see what the value set at the course-level is. user_partitions = UserPartitionList( help=_("The list of group configurations for partitioning students in content experiments."), default=[], scope=Scope.settings ) user_partition_id = Integer( help=_("The configuration defines how users are grouped for this content experiment. Caution: Changing the group configuration of a student-visible experiment will impact the experiment data."), scope=Scope.content, display_name=_("Group Configuration"), default=no_partition_selected["value"], values=lambda: SplitTestFields.user_partition_values # Will be populated before the Studio editor is shown. ) # group_id is an int # child is a serialized UsageId (aka Location). This child # location needs to actually match one of the children of this # Block. (expected invariant that we'll need to test, and handle # authoring tools that mess this up) # TODO: is there a way to add some validation around this, to # be run on course load or in studio or .... group_id_to_child = ReferenceValueDict( help=_("Which child module students in a particular group_id should see"), scope=Scope.content )
class ReferenceTestXBlock(XBlock, XModuleMixin): """ Test xblock type to test the reference field types """ has_children = True reference_link = Reference(default=None, scope=Scope.content) reference_list = ReferenceList(scope=Scope.content) reference_dict = ReferenceValueDict(scope=Scope.settings)
class SplitTestFields(object): """Fields needed for split test module""" user_partition_id = Integer( help="Which user partition is used for this test", scope=Scope.content) # group_id is an int # child is a serialized UsageId (aka Location). This child # location needs to actually match one of the children of this # Block. (expected invariant that we'll need to test, and handle # authoring tools that mess this up) # TODO: is there a way to add some validation around this, to # be run on course load or in studio or .... group_id_to_child = ReferenceValueDict( help="Which child module students in a particular group_id should see", scope=Scope.content)
class SplitTestFields: """Fields needed for split test module""" has_children = True # Default value used for user_partition_id no_partition_selected = {'display_name': _("Not Selected"), 'value': -1} display_name = String( display_name=_("Display Name"), help=_("The display name for this component. (Not shown to learners)"), scope=Scope.settings, default=_("Content Experiment")) # Specified here so we can see what the value set at the course-level is. user_partitions = UserPartitionList(help=_( "The list of group configurations for partitioning students in content experiments." ), default=[], scope=Scope.settings) user_partition_id = Integer( help= _("The configuration defines how users are grouped for this content experiment. Caution: Changing the group configuration of a student-visible experiment will impact the experiment data." ), # lint-amnesty, pylint: disable=line-too-long scope=Scope.content, display_name=_("Group Configuration"), default=no_partition_selected["value"], values=lambda: user_partition_values. values # Will be populated before the Studio editor is shown. ) # group_id is an int # child is a serialized UsageId (aka Location). This child # location needs to actually match one of the children of this # Block. (expected invariant that we'll need to test, and handle # authoring tools that mess this up) group_id_to_child = ReferenceValueDict(help=_( "Which child module students in a particular group_id should see"), scope=Scope.content)