fix: guard access to course block children in outline tab data
In some cases the course blocks API was returning a dict without a 'children' key, which was causing a traceback. If the course blocks API has no children, that's IS a problem, but still better than erroring out due to a KeyError. AA-1267
This commit is contained in:
@@ -289,7 +289,7 @@ class OutlineTabView(RetrieveAPIView):
|
||||
|
||||
# course_blocks is a reference to the root of the course, so we go
|
||||
# through the chapters (sections) to look for sequences to remove.
|
||||
for chapter_data in course_blocks['children']:
|
||||
for chapter_data in course_blocks.get('children', []):
|
||||
chapter_data['children'] = [
|
||||
seq_data
|
||||
for seq_data in chapter_data['children']
|
||||
|
||||
Reference in New Issue
Block a user