Fix hidden default group bug
This commit is contained in:
parent
55fc5da9a7
commit
3e86d9a620
|
|
@ -50,6 +50,12 @@ def migrate_objectives_to_content():
|
||||||
else:
|
else:
|
||||||
default_content_block = created_default_content_blocks[default_objectives_ids]
|
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)
|
custom_objectives_by_owner = get_objectives_by_owner(objective_group)
|
||||||
|
|
||||||
if default_objectives or custom_objectives_by_owner:
|
if default_objectives or custom_objectives_by_owner:
|
||||||
|
|
|
||||||
|
|
@ -92,14 +92,14 @@ class TestObjectivesMigration(SkillboxTestCase):
|
||||||
})
|
})
|
||||||
module = result.data['module']
|
module = result.data['module']
|
||||||
chapter1 = module['chapters'][0]
|
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)
|
# default content block (Verlagsinhalte) exists but is hidden (since one objective is hidden for this class)
|
||||||
self.assertEqual(hidden_custom['title'], 'Sprache & Kommunikation')
|
self.assertEqual(hidden_default['title'], 'Sprache & Kommunikation')
|
||||||
self.assertTrue(hidden_custom['originalCreator'] is None)
|
self.assertTrue(hidden_default['originalCreator'] is None)
|
||||||
self.assertEqual(hidden_custom['hiddenFor'], [{'name': 'skillbox'}])
|
self.assertEqual(hidden_default['hiddenFor'], [{'name': 'skillbox'}])
|
||||||
self.assertEqual(hidden_custom['visibleFor'], [])
|
self.assertEqual(hidden_default['visibleFor'], [])
|
||||||
self.assertEqual(hidden_custom['contents'][0]['value']['text'], '<ul><li>objective1</li></ul>')
|
self.assertEqual(hidden_default['contents'][0]['value']['text'], '<ul><li>objective1</li></ul>')
|
||||||
|
|
||||||
def test_objectives_order(self):
|
def test_objectives_order(self):
|
||||||
"""The correct oder of the objectives is:
|
"""The correct oder of the objectives is:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue