Skip to content
Snippets Groups Projects
Commit a16f5487 authored by Andy Armstrong's avatar Andy Armstrong
Browse files

First attempt to fix split test

parent 356da9ca
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,20 @@ class PreviewModuleSystem(ModuleSystem): # pylint: disable=abstract-method
return local_resource_url(block, uri)
class StudioUserService(object):
"""
Provides a Studio implementation of the XBlock user service.
"""
def __init__(self, request):
super(StudioUserService, self).__init__()
self._request = request
@property
def user_id(self):
return self._request.user.id
def _preview_module_system(request, descriptor):
"""
Returns a ModuleSystem for the specified descriptor that is specialized for
......@@ -139,6 +153,7 @@ def _preview_module_system(request, descriptor):
descriptor_runtime=descriptor.runtime,
services={
"i18n": ModuleI18nService(),
"user": StudioUserService(request),
},
)
......
......@@ -343,6 +343,7 @@ class SplitTestModule(SplitTestFields, XModule, StudioEditableModule):
@XBlock.needs('user_tags') # pylint: disable=abstract-method
@XBlock.wants('partitions')
@XBlock.needs('user')
class SplitTestDescriptor(SplitTestFields, SequenceDescriptor, StudioEditableDescriptor):
# the editing interface can be the same as for sequences -- just a container
module_class = SplitTestModule
......@@ -553,7 +554,8 @@ class SplitTestDescriptor(SplitTestFields, SequenceDescriptor, StudioEditableDes
for group in user_partition.groups:
str_group_id = unicode(group.id)
if str_group_id not in self.group_id_to_child:
self._create_vertical_for_group(group, request.user.id)
user_id = self.runtime.service(self, 'user').user_id
self._create_vertical_for_group(group, user_id)
changed = True
if changed:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment