From 1754c44037bf03f00c720c175aacaf8ecedafa37 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Thu, 25 Jul 2024 13:43:59 +0300 Subject: [PATCH] fix: fix cache_for_block_descendents cherry-pick test failures --- lms/djangoapps/mobile_api/users/views.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index b5b900b4504c..81051057b7aa 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -155,7 +155,7 @@ def _last_visited_block_path(self, request, course): the course block. If there is no such visit, the first item deep enough down the course tree is used. """ - field_data_cache = FieldDataCache.cache_for_block_descendents( + field_data_cache = FieldDataCache.cache_for_descriptor_descendents( course.id, request.user, course, depth=2) course_block = get_block_for_descriptor( @@ -188,15 +188,14 @@ def _update_last_visited_module_id(self, request, course, module_key, modificati """ Saves the module id if the found modification_date is less recent than the passed modification date """ - field_data_cache = FieldDataCache.cache_for_block_descendents( + field_data_cache = FieldDataCache.cache_for_descriptor_descendents( course.id, request.user, course, depth=2) try: - descriptor = modulestore().get_item(module_key) + block_descriptor = modulestore().get_item(module_key) except ItemNotFoundError: - log.error(f"{errors.ERROR_INVALID_MODULE_ID} %s", module_key) return Response(errors.ERROR_INVALID_MODULE_ID, status=400) block = get_block_for_descriptor( - request.user, request, descriptor, field_data_cache, course.id, course=course + request.user, request, block_descriptor, field_data_cache, course.id, course=course ) if modification_date: