from xmodule.modulestore.django import modulestore
from openedx.features.course_experience.url_helpers import make_learning_mfe_courseware_url
i tried to do this like as , be sure course should have section ,subsection and atleast one unit or you can at add your custom conditions to handle this
Traceback (most recent call last):
File “”, line 1, in
File “/openedx/edx-platform/xmodule/seq_module.py”, line 395, in get_metadata
if prereq_met and view == STUDENT_VIEW and not self._can_user_view_content(course):
File “/openedx/edx-platform/xmodule/seq_module.py”, line 562, in _can_user_view_content
self.runtime.service(self, ‘user’).get_current_user().opt_attrs.get(ATTR_KEY_USER_IS_STAFF) or
File “/openedx/edx-platform/xmodule/x_module.py”, line 1879, in service
service = self._descriptor_system.service(block, service_name)
File “/openedx/edx-platform/xmodule/x_module.py”, line 1241, in service
service = super().service(block=block, service_name=service_name)
File “/openedx/venv/lib/python3.8/site-packages/xblock/runtime.py”, line 1125, in service
raise NoSuchServiceError(f"Service {service_name!r} is not available.")
xblock.exceptions.NoSuchServiceError: Service ‘user’ is not available.
It works fine till modulestore().get_course(course_key).get_children()[0].get_children()[0], but when i try to get metadata then it arises.
try this first_sequeceid = modulestore().get_course(user_course_outline.course_key).get_children()[0].get_children()[0].scope_ids.usage_id
instead of this