Cleaning up ABTest properties

This commit is contained in:
Calen Pennington
2012-12-21 11:12:03 -05:00
parent 9bd42278e9
commit e4c06fab4a

View File

@@ -39,13 +39,15 @@ class ABTestModule(XModule):
group_portions = Object(help="What proportions of students should go in each group", default={DEFAULT: 1}, scope=Scope.content)
group_assignments = Object(help="What group this user belongs to", scope=Scope.student_preferences, default={})
group_content = Object(help="What content to display to each group", scope=Scope.content, default={DEFAULT: []})
experiment = String(help="Experiment that this A/B test belongs to", scope=Scope.content)
has_children = True
def __init__(self, *args, **kwargs):
XModule.__init__(self, *args, **kwargs)
if self.group is None:
self.group = group_from_value(
self.group_portions,
self.group_portions.items(),
random.uniform(0, 1)
)
@@ -80,6 +82,7 @@ class ABTestDescriptor(RawDescriptor, XmlDescriptor):
experiment = String(help="Experiment that this A/B test belongs to", scope=Scope.content)
group_portions = Object(help="What proportions of students should go in each group", default={})
group_content = Object(help="What content to display to each group", scope=Scope.content, default={DEFAULT: []})
has_children = True
@classmethod
def definition_from_xml(cls, xml_object, system):