Fix chapter visibility properties

This commit is contained in:
Ramon Wenger 2021-06-14 16:01:29 +02:00
parent 01117b5880
commit e2c989f4a2
2 changed files with 8 additions and 1 deletions

View File

@ -144,7 +144,7 @@ class Snapshot(models.Model):
content_block.hidden_for.add(selected_class)
for custom_content_block in self.custom_content_blocks.all():
custom_content_block.to_regular_content_block(owner=user, school_class=selected_class)
for chapter_snapshot in self.chapters.through.objects.all():
for chapter_snapshot in ChapterSnapshot.objects.filter(snapshot=self):
chapter = chapter_snapshot.chapter
if chapter_snapshot.title_hidden:
chapter.title_hidden_for.add(selected_class)

View File

@ -317,6 +317,13 @@ class CreateSnapshotTestCase(SkillboxTestCase):
def test_snapshot_chapter_visibility_after_apply(self):
result = self.graphene_client.execute(CREATE_SNAPSHOT_MUTATION, variables={
'input': {
'module': self.slug,
'selectedClass': to_global_id('SchoolClassNode', self.skillbox_class.pk),
}
})
self.chapter.title_hidden_for.remove(self.skillbox_class)
self.chapter.description_hidden_for.remove(self.skillbox_class)