Skip to content

Commit

Permalink
fix: fix problem block offline generations
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan committed Jun 17, 2024
1 parent 8f0a187 commit 87393cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openedx/features/offline_mode/assets_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def save_asset_file(temp_dir, xblock, path, filename):
static_path = get_static_file_path(filename)
content = read_static_file(static_path)
file_path = os.path.join(temp_dir, 'assets', filename)
except (ItemNotFoundError, NotFoundError):
except (FileNotFoundError, ItemNotFoundError, NotFoundError):
log.info(f"Asset not found: {filename}")

else:
Expand Down
2 changes: 1 addition & 1 deletion openedx/features/offline_mode/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MATHJAX_CDN_URL = f'https://cdn.jsdelivr.net/npm/mathjax@{MATHJAX_VERSION}/MathJax.js'
MATHJAX_STATIC_PATH = os.path.join('assets', 'js', f'MathJax-{MATHJAX_VERSION}.js')

DEFAULT_OFFLINE_SUPPORTED_XBLOCKS = ['html']
DEFAULT_OFFLINE_SUPPORTED_XBLOCKS = ['html', 'problem']
OFFLINE_SUPPORTED_XBLOCKS = getattr(settings, 'OFFLINE_SUPPORTED_XBLOCKS', DEFAULT_OFFLINE_SUPPORTED_XBLOCKS)

RETRY_BACKOFF_INITIAL_TIMEOUT = 60 # one minute
Expand Down
2 changes: 1 addition & 1 deletion openedx/features/offline_mode/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def render_xblock_from_lms(self):
str(self.usage_key),
disable_staff_debug_info=True,
course=course,
will_recheck_access='1',
will_recheck_access=False,
)

enable_completion_on_view_service = False
Expand Down
6 changes: 4 additions & 2 deletions openedx/features/offline_mode/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ def generate_offline_content_for_course(course_id):
course_key = CourseKey.from_string(course_id)
for offline_supported_block_type in OFFLINE_SUPPORTED_XBLOCKS:
for xblock in modulestore().get_items(course_key, qualifiers={'category': offline_supported_block_type}):
html_data = XBlockRenderer(str(xblock.location)).render_xblock_from_lms()
generate_offline_content_for_block.apply_async([str(xblock.location), html_data])
if hasattr(xblock, 'closed') and not xblock.closed():
block_id = str(xblock.location)
html_data = XBlockRenderer(block_id).render_xblock_from_lms()
generate_offline_content_for_block.apply_async([block_id, html_data])


@shared_task(
Expand Down

0 comments on commit 87393cd

Please sign in to comment.