diff --git a/server/books/management/commands/migrate_objectives_to_content.py b/server/books/management/commands/migrate_objectives_to_content.py index 48211b5f..4bc7f8a5 100644 --- a/server/books/management/commands/migrate_objectives_to_content.py +++ b/server/books/management/commands/migrate_objectives_to_content.py @@ -50,6 +50,12 @@ def migrate_objectives_to_content(): else: default_content_block = created_default_content_blocks[default_objectives_ids] + # set visibility for objective_group + if objective_group.hidden_for.exists(): + default_content_block.hidden_for.add(*objective_group.hidden_for.all()) + default_content_block.save_revision().publish() + default_content_block.save() + custom_objectives_by_owner = get_objectives_by_owner(objective_group) if default_objectives or custom_objectives_by_owner: diff --git a/server/books/tests/test_objectives_migration.py b/server/books/tests/test_objectives_migration.py index 8fe1f6b6..b7d0573a 100644 --- a/server/books/tests/test_objectives_migration.py +++ b/server/books/tests/test_objectives_migration.py @@ -92,14 +92,14 @@ class TestObjectivesMigration(SkillboxTestCase): }) module = result.data['module'] chapter1 = module['chapters'][0] - hidden_custom, _, _, _ = chapter1['contentBlocks'] + hidden_default, _, _, _ = chapter1['contentBlocks'] # default content block (Verlagsinhalte) exists but is hidden (since one objective is hidden for this class) - self.assertEqual(hidden_custom['title'], 'Sprache & Kommunikation') - self.assertTrue(hidden_custom['originalCreator'] is None) - self.assertEqual(hidden_custom['hiddenFor'], [{'name': 'skillbox'}]) - self.assertEqual(hidden_custom['visibleFor'], []) - self.assertEqual(hidden_custom['contents'][0]['value']['text'], '