Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test failure] < TC_AUTHOR_146 >: Cannot request course creator permission #428

Closed
angonz opened this issue Dec 2, 2024 · 7 comments · Fixed by openedx/edx-platform#35942
Assignees
Labels
release testing Affects the upcoming release (attention needed) sumac

Comments

@angonz
Copy link

angonz commented Dec 2, 2024

Release

Sumac

Expected behavior

A regular user (non staff, non superuser) should be able to request course creator permission after logging into Studio.

Actual behavior

Studio home page displays "Failed to fetch courses. Please try again later." No button to request course creator permission is shown.
image

Steps to reproduce

Go to https://studio.sumac.demo.edly
Login with "student" user
You should be redirected to https://apps.sumac.demo.edly.io/authoring/home

Additional information

No response

@angonz angonz added release testing Affects the upcoming release (attention needed) needs triage labels Dec 2, 2024
@mariajgrimaldi mariajgrimaldi self-assigned this Dec 2, 2024
@mariajgrimaldi mariajgrimaldi added the release blocker Blocks the upcoming release (fix needed) label Dec 2, 2024
@mariajgrimaldi
Copy link
Member

mariajgrimaldi commented Dec 2, 2024

I could reproduce this in the sandbox with a brand-new user. This endpoint is raising a 500 error: https://studio.sumac.demo.edly.io/api/contentstore/v2/home/courses?page=1&order=display_name

I already asked the sandbox maintainer for server logs so we can know more.

EDIT: @DawoudSheraz, if you can, please paste the logs in this thread. Thank you!

@mariajgrimaldi
Copy link
Member

mariajgrimaldi commented Dec 2, 2024

I know what’s wrong because I implemented the feature that’s failing. I’m working on fixing it now, and thankfully, it’s easy to solve. I'll let you know once I have a PR.

@DawoudSheraz
Copy link

Stack trace

cms-1                   | 2024-12-02 16:04:38,804 ERROR 23 [root] [user None] [ip None] signals.py:22 - Uncaught exception from None
cms-1                   | Traceback (most recent call last):
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
cms-1                   |     response = get_response(request)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
cms-1                   |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/opt/pyenv/versions/3.11.8/lib/python3.11/contextlib.py", line 81, in inner
cms-1                   |     return func(*args, **kwds)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
cms-1                   |     return view_func(*args, **kwargs)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
cms-1                   |     return self.dispatch(request, *args, **kwargs)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
cms-1                   |     response = self.handle_exception(exc)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
cms-1                   |     self.raise_uncaught_exception(exc)
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
cms-1                   |     raise exc
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
cms-1                   |     response = handler(request, *args, **kwargs)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/rest_api/v2/views/home.py", line 136, in get
cms-1                   |     courses, in_process_course_actions = get_course_context_v2(request)
cms-1                   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/utils.py", line 1666, in get_course_context_v2
cms-1                   |     courses_iter, in_process_course_actions = get_courses_accessible_to_user(request, org)
cms-1                   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/opt/pyenv/versions/3.11.8/lib/python3.11/contextlib.py", line 81, in inner
cms-1                   |     return func(*args, **kwds)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 770, in get_courses_accessible_to_user
cms-1                   |     courses, in_process_course_actions = _accessible_courses_list_from_groups(request)
cms-1                   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 580, in _accessible_courses_list_from_groups
cms-1                   |     courses_list = get_filtered_and_ordered_courses(
cms-1                   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 485, in get_filtered_and_ordered_courses
cms-1                   |     course_overviews = get_courses_order_by(order, course_overviews)
cms-1                   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 627, in get_courses_order_by
cms-1                   |     return course_overviews.order_by(order_query)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   | AttributeError: 'list' object has no attribute 'order_by'

@mariajgrimaldi
Copy link
Member

Here's the PR that fixes this issue: openedx/edx-platform#35942

mariajgrimaldi added a commit to openedx/edx-platform that referenced this issue Dec 5, 2024
This change addresses an issue reported while testing Sumac, where the API V2 is on by default in the authoring MFE: openedx/wg-build-test-release#428. It fails when retrieving an empty list of courses with the queryparams api/contentstore/v2/home/courses?page=1&order=display_name. When this was implemented, the course authoring MFE rendered the empty lists only with page=1 query param (didn't do any filtering/ordering by default), which was later changed to page=1&order=display_name which now ordered by default.

This issue occurs because all the filtering and ordering are done under the assumption that course_overviews is always a query set. However, that's only true when there are courses available and CourseOverview.get_all_courses is used. When not, an empty list is returned instead, raising a 500 error in Studio.
@github-project-automation github-project-automation bot moved this from In progress to Done in Build-Test-Release Working Group Dec 5, 2024
@mariajgrimaldi
Copy link
Member

Reopening this since I still need to backport the changes.

@mariajgrimaldi mariajgrimaldi reopened this Dec 5, 2024
mariajgrimaldi added a commit to openedx/edx-platform that referenced this issue Dec 5, 2024
This change addresses an issue reported while testing Sumac, where the API V2 is on by default in the authoring MFE: openedx/wg-build-test-release#428. It fails when retrieving an empty list of courses with the queryparams api/contentstore/v2/home/courses?page=1&order=display_name. When this was implemented, the course authoring MFE rendered the empty lists only with page=1 query param (didn't do any filtering/ordering by default), which was later changed to page=1&order=display_name which now ordered by default.

This issue occurs because all the filtering and ordering are done under the assumption that course_overviews is always a query set. However, that's only true when there are courses available and CourseOverview.get_all_courses is used. When not, an empty list is returned instead, raising a 500 error in Studio.
mariajgrimaldi added a commit to openedx/edx-platform that referenced this issue Dec 5, 2024
This change addresses an issue reported while testing Sumac, where the API V2 is on by default in the authoring MFE: openedx/wg-build-test-release#428. It fails when retrieving an empty list of courses with the queryparams api/contentstore/v2/home/courses?page=1&order=display_name. When this was implemented, the course authoring MFE rendered the empty lists only with page=1 query param (didn't do any filtering/ordering by default), which was later changed to page=1&order=display_name which now ordered by default.

This issue occurs because all the filtering and ordering are done under the assumption that course_overviews is always a query set. However, that's only true when there are courses available and CourseOverview.get_all_courses is used. When not, an empty list is returned instead, raising a 500 error in Studio.
farhaanbukhsh pushed a commit to openedx/edx-platform that referenced this issue Dec 9, 2024
This change addresses an issue reported while testing Sumac, where the API V2 is on by default in the authoring MFE: openedx/wg-build-test-release#428. It fails when retrieving an empty list of courses with the queryparams api/contentstore/v2/home/courses?page=1&order=display_name. When this was implemented, the course authoring MFE rendered the empty lists only with page=1 query param (didn't do any filtering/ordering by default), which was later changed to page=1&order=display_name which now ordered by default.

This issue occurs because all the filtering and ordering are done under the assumption that course_overviews is always a query set. However, that's only true when there are courses available and CourseOverview.get_all_courses is used. When not, an empty list is returned instead, raising a 500 error in Studio.
@arbrandes arbrandes removed the release blocker Blocks the upcoming release (fix needed) label Dec 9, 2024
@mariajgrimaldi
Copy link
Member

Fixed in the sandbox! @angonz: could you help me retest please? Thank you!

@angonz
Copy link
Author

angonz commented Dec 9, 2024

Test passed!

@angonz angonz closed this as completed Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release testing Affects the upcoming release (attention needed) sumac
Projects
Development

Successfully merging a pull request may close this issue.

4 participants