refactor: rename module -> block within remaining openedx/features

This commit is contained in:
0x29a
2022-12-30 11:13:30 +01:00
committed by Agrendalath
parent a299046540
commit c3f672a399
2 changed files with 7 additions and 7 deletions

View File

@@ -59,12 +59,12 @@ def get_ordered_updates(request, course):
"""
Returns all public course updates in reverse chronological order, including dismissed ones.
"""
info_module = get_course_info_section_block(request, request.user, course, 'updates')
if not info_module:
info_block = get_course_info_section_block(request, request.user, course, 'updates')
if not info_block:
return []
info_block = getattr(info_module, '_xmodule', info_module)
ordered_updates = [update for update in info_module.items if update.get('status') == STATUS_VISIBLE]
info_block = getattr(info_block, '_xmodule', info_block)
ordered_updates = [update for update in info_block.items if update.get('status') == STATUS_VISIBLE]
ordered_updates.sort(
key=lambda item: (_safe_parse_date(item['date']), item['id']),
reverse=True

View File

@@ -76,8 +76,8 @@ class CourseUpdatesFragmentView(EdxFragmentView):
for older implementations and a few tests that store
a single html object representing all the updates.
"""
info_module = get_course_info_section_block(request, request.user, course, 'updates')
info_block = getattr(info_module, '_xmodule', info_module)
info_block = get_course_info_section_block(request, request.user, course, 'updates')
info_block = getattr(info_block, '_xmodule', info_block)
return info_block.system.service(
info_block, "replace_urls"
).replace_urls(info_module.data) if info_module else ''
).replace_urls(info_block.data) if info_block else ''