Merge branch 'develop'
This commit is contained in:
commit
6a2b518c73
|
|
@ -9,6 +9,19 @@ from rooms.models import ModuleRoomSlug
|
||||||
from ..models import Book, Topic, Module, Chapter, ContentBlock
|
from ..models import Book, Topic, Module, Chapter, ContentBlock
|
||||||
|
|
||||||
|
|
||||||
|
def process_module_room_slug_block(content):
|
||||||
|
if content['type'] == 'module_room_slug':
|
||||||
|
try:
|
||||||
|
module_room_slug = ModuleRoomSlug.objects.get(title=content['value']['title'])
|
||||||
|
content['value'] = {
|
||||||
|
'title': content['value']['title'],
|
||||||
|
'slug': module_room_slug.slug
|
||||||
|
}
|
||||||
|
except ModuleRoomSlug.DoesNotExist:
|
||||||
|
pass
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
class ContentBlockNode(DjangoObjectType):
|
class ContentBlockNode(DjangoObjectType):
|
||||||
mine = graphene.Boolean()
|
mine = graphene.Boolean()
|
||||||
|
|
||||||
|
|
@ -31,15 +44,11 @@ class ContentBlockNode(DjangoObjectType):
|
||||||
if not are_solutions_enabled_for(info.context.user, self.module) and content['type'] == 'solution':
|
if not are_solutions_enabled_for(info.context.user, self.module) and content['type'] == 'solution':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if content['type'] == 'module_room_slug':
|
if content['type'] == 'content_list_item':
|
||||||
try:
|
for index, list_block in enumerate(content['value']):
|
||||||
module_room_slug = ModuleRoomSlug.objects.get(title=content['value']['title'])
|
content['value'][index] = process_module_room_slug_block(list_block)
|
||||||
content['value'] = {
|
|
||||||
'title': content['value']['title'],
|
content = process_module_room_slug_block(content)
|
||||||
'slug': module_room_slug.slug
|
|
||||||
}
|
|
||||||
except ModuleRoomSlug.DoesNotExist:
|
|
||||||
pass
|
|
||||||
updated_stream_data.append(content)
|
updated_stream_data.append(content)
|
||||||
|
|
||||||
self.contents.stream_data = updated_stream_data
|
self.contents.stream_data = updated_stream_data
|
||||||
|
|
@ -108,7 +117,6 @@ class ModuleNode(DjangoObjectType):
|
||||||
return Chapter.get_by_parent(self)
|
return Chapter.get_by_parent(self)
|
||||||
|
|
||||||
def resolve_topic(self, info, **kwargs):
|
def resolve_topic(self, info, **kwargs):
|
||||||
some = self.get_parent().specific
|
|
||||||
return self.get_parent().specific
|
return self.get_parent().specific
|
||||||
|
|
||||||
def resolve_solutions_enabled(self, info, **kwargs):
|
def resolve_solutions_enabled(self, info, **kwargs):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue