Merge branch 'feature/Anzeige-Bookmarks' into develop
This commit is contained in:
commit
1ae8de894b
|
|
@ -1,5 +1,8 @@
|
|||
import json
|
||||
import uuid
|
||||
import graphene
|
||||
|
||||
from basicknowledge.models import BasicKnowledge
|
||||
from basicknowledge.queries import InstrumentNode
|
||||
from books.schema.nodes import ContentBlockNode, ModuleNode
|
||||
from books.schema.nodes.chapter import ChapterNode
|
||||
|
|
@ -19,7 +22,7 @@ logger = get_logger(__name__)
|
|||
|
||||
content_dict = {
|
||||
'assignment': 'Auftrag',
|
||||
'basic_knowledge': '',
|
||||
'basic_knowledge': 'dsafasdfasdf',
|
||||
'survey': 'Übung',
|
||||
'image_block': 'Bild',
|
||||
'link_block': 'Link',
|
||||
|
|
@ -39,11 +42,24 @@ def find_content(content_list, bookmark):
|
|||
found = (content for content in content_list if uuid.UUID(content['id']) == bookmark.uuid)
|
||||
content = next(found, None)
|
||||
if content is None:
|
||||
for c in content_list:
|
||||
if c.get('id') == bookmark.uuid:
|
||||
return c.get('value').get('text', '')
|
||||
return c.get('value').get('text', '')
|
||||
return ''
|
||||
if content['type'] in ['text_block', 'subtitle', 'solution']:
|
||||
return content['value'].get('text', '')
|
||||
if content['type'] in ['basic_knowledge']:
|
||||
return content['value'].get('description', '')
|
||||
description = content['value'].get('description', '')
|
||||
if not description:
|
||||
try:
|
||||
return BasicKnowledge.objects.get(pk=content['value']['basic_knowledge']).title
|
||||
except BasicKnowledge.DoesNotExist:
|
||||
return ''
|
||||
else:
|
||||
return description
|
||||
print(bookmark.uuid)
|
||||
print(json.dumps(content_dict, indent=4))
|
||||
return content_dict.get(content['type'], '')
|
||||
|
||||
class NoteNode(DjangoObjectType):
|
||||
|
|
|
|||
Loading…
Reference in New Issue