Fix unit test
This commit is contained in:
parent
be9a829b01
commit
0bef8fe570
|
|
@ -37,12 +37,12 @@ class SnapshotManager(models.Manager):
|
||||||
title_hidden=chapter.title_hidden_for.filter(id=school_class.id).exists(),
|
title_hidden=chapter.title_hidden_for.filter(id=school_class.id).exists(),
|
||||||
description_hidden=chapter.description_hidden_for.filter(id=school_class.id).exists()
|
description_hidden=chapter.description_hidden_for.filter(id=school_class.id).exists()
|
||||||
)
|
)
|
||||||
base_qs = ContentBlock.get_by_parent(chapter).filter(snapshotcontentblock__isnull=True)
|
base_qs = ContentBlock.get_by_parent(chapter).filter(contentblocksnapshot__isnull=True)
|
||||||
for content_block in base_qs.filter(user_created=False):
|
for content_block in base_qs.filter(user_created=False):
|
||||||
if content_block.hidden_for.filter(id=school_class.id).exists():
|
if content_block.hidden_for.filter(id=school_class.id).exists():
|
||||||
snapshot.hidden_content_blocks.add(content_block)
|
snapshot.hidden_content_blocks.add(content_block)
|
||||||
for content_block in base_qs.filter(user_created=True).filter(owner=user):
|
for content_block in base_qs.filter(user_created=True).filter(owner=user):
|
||||||
new_content_block = SnapshotContentBlock(
|
new_content_block = ContentBlockSnapshot(
|
||||||
hidden=False,
|
hidden=False,
|
||||||
snapshot=snapshot,
|
snapshot=snapshot,
|
||||||
contents=content_block.contents,
|
contents=content_block.contents,
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,11 @@ class SnapshotChapterNode(DjangoObjectType):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_title_hidden(parent, info):
|
def resolve_title_hidden(parent, info):
|
||||||
return parent
|
return parent.title_hidden
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def resolve_description_hidden(parent, info):
|
||||||
|
return parent.description_hidden
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_title(parent, info):
|
def resolve_title(parent, info):
|
||||||
|
|
@ -82,18 +86,13 @@ class SnapshotChapterNode(DjangoObjectType):
|
||||||
|
|
||||||
user_created = Q(user_created=True)
|
user_created = Q(user_created=True)
|
||||||
hidden_for_snapshot = Q(hidden_for_snapshots=snapshot)
|
hidden_for_snapshot = Q(hidden_for_snapshots=snapshot)
|
||||||
custom_hidden = Q(snapshotcontentblock__hidden=True)
|
custom_hidden = Q(contentblocksnapshot__hidden=True)
|
||||||
|
|
||||||
qs = ContentBlock.get_by_parent(parent.chapter) \
|
qs = ContentBlock.get_by_parent(parent.chapter) \
|
||||||
.exclude(user_created) \
|
.exclude(user_created) \
|
||||||
.exclude(hidden_for_snapshot) \
|
.exclude(hidden_for_snapshot) \
|
||||||
.exclude(custom_hidden)
|
.exclude(custom_hidden)
|
||||||
|
|
||||||
|
|
||||||
# exclude hidden for snapshot
|
|
||||||
# exclude with owner
|
|
||||||
# include visible snapshot content blocks
|
|
||||||
# todo
|
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
def resolve_id(self, *args):
|
def resolve_id(self, *args):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue