Revert "handle missing fields on access denied blocks"

This reverts commit 418540b713.
This commit is contained in:
Matthew Piatetsky
2019-04-08 12:13:30 -04:00
parent 9de5e65b75
commit be9eb46364
3 changed files with 11 additions and 11 deletions

View File

@@ -26,7 +26,7 @@ def get_blocks(
student_view_data=None,
return_type='dict',
block_types_filter=None,
hide_access_denials=False,
hide_access_denials=True,
):
"""
Return a serialized representation of the course blocks.

View File

@@ -90,12 +90,13 @@ def get_course_outline_block_tree(request, course_id, user=None):
latest_completion,
block=block['children'][idx]
)
if block['children'][idx].get('resume_block') is True:
if block['children'][idx]['resume_block'] is True:
block['resume_block'] = True
completable_blocks = [child for child in block['children']
if child.get('type') != 'discussion']
if all(child.get('complete') for child in completable_blocks):
if child['type'] != 'discussion']
if len([child['complete'] for child in block['children']
if child['complete']]) == len(completable_blocks):
block['complete'] = True
def mark_last_accessed(user, course_key, block):
@@ -172,7 +173,7 @@ def get_resume_block(block):
Gets the deepest block marked as 'resume_block'.
"""
if block.get('authorization_denial_reason') or not block['resume_block']:
if not block['resume_block']:
return None
if not block.get('children'):
return block

View File

@@ -76,13 +76,12 @@ class CourseOutlineFragmentView(EdxFragmentView):
if xblock_display_names is None:
xblock_display_names = {}
if not course_block_tree.get('authorization_denial_reason'):
if course_block_tree.get('id'):
xblock_display_names[course_block_tree['id']] = course_block_tree['display_name']
if course_block_tree.get('id'):
xblock_display_names[course_block_tree['id']] = course_block_tree['display_name']
if course_block_tree.get('children'):
for child in course_block_tree['children']:
self.create_xblock_id_and_name_dict(child, xblock_display_names)
if course_block_tree.get('children'):
for child in course_block_tree['children']:
self.create_xblock_id_and_name_dict(child, xblock_display_names)
return xblock_display_names