Skip to content

Commit

Permalink
feat: allow to prefetch xblock aside fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 31, 2023
1 parent 9e65024 commit 0388ded
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lms/djangoapps/courseware/model_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,18 @@ def _fields_to_cache(self, blocks):
for block in blocks:
for field in block.fields.values():
scope_map[field.scope].add(field)
return scope_map

try:
block = blocks[0]
from openedx.core.lib.xblock_utils import get_aside_from_xblock # pylint: disable=import-outside-toplevel
for aside in self.asides:
xblock_aside = get_aside_from_xblock(block, aside)
for field in xblock_aside.fields.values():
scope_map[field.scope].add(field)
return scope_map
except IndexError:
# No blocks to cache
return scope_map

def get(self, key):
"""
Expand Down

0 comments on commit 0388ded

Please sign in to comment.