frontend-app-learning icon indicating copy to clipboard operation
frontend-app-learning copied to clipboard

When navigating gated content, the previous and next buttons stop working

Open mariajgrimaldi opened this issue 1 year ago • 6 comments

Description

When navigating gated content, the previous and next buttons stop working so the user can't go to previous/next subsections.

Expected behavior

As a learner, upon navigating to a gated unit, you should see a message about completing the prerequisite, and both the "Previous" and "Next" buttons should function correctly.

Actual behavior

As a learner, when you navigate to a gated unit, you see the message prompting you to complete the prerequisite, but the "Previous" and "Next" buttons do not work. https://jam.dev/c/4f02a831-969b-4c18-beab-378b45a09e9e

Steps to reproduce

  1. Log in as a learner and navigate to a unit that is gated by the prerequisite.
  2. Observe the message about completing the prerequisite and attempt to use the "Previous" and "Next" buttons.

Originally reported here: https://github.com/openedx/wg-build-test-release/issues/414

mariajgrimaldi avatar Dec 02 '24 18:12 mariajgrimaldi

I could reproduce this after doing the following:

  1. Configuring a subsection as a prerequisite
  2. Making that subsection the prerequisite of another subsection
  3. Go to the prerequisite subsection and navigate to the gated subsection
  4. If I try to go to the previous unit right before the gated subsection, the sequence buttons stop working for some reason
  5. If from the sidebar I try entering one of the units in the gated subsection, and the previous button works

Here's a video:

Screencast from 02-12-24 18:53:14.webm

mariajgrimaldi avatar Dec 02 '24 18:12 mariajgrimaldi

Does this relate to https://github.com/openedx/frontend-app-learning/pull/1429 at all?

bradenmacdonald avatar Dec 02 '24 18:12 bradenmacdonald

@bradenmacdonald: I'm not sure, but I asked my team for help looking into it. Hopefully, they'll have some ideas soon.

mariajgrimaldi avatar Dec 03 '24 16:12 mariajgrimaldi

FYI @farhaanbukhsh

mariajgrimaldi avatar Dec 05 '24 15:12 mariajgrimaldi

First update

After seeing the behavior of the URLs once you go to a gated subsection with the help of the navigation buttons, I was able to verify the following:

When passing between two normal subsections, the URL of the next button is formed by adding /first to the url of the sequential (subsection), for example:

http://apps.local.openedx.io/learning/course/course-v1:OpenedX+DemoX+DemoCourse/block-v1:OpenedX+DemoX+DemoCourse+type@sequential+block@54bed3d4d5854713bde4300681fb7d18/first

After this, it is redirected to the vertical URL (unit)

http://apps.local.openedx.io/learning/course/course-v1:OpenedX+DemoX+DemoCourse/block-v1:OpenedX+DemoX+DemoCourse+type@sequential+block@54bed3d4d5854713bde4300681fb7d18/block-v1:OpenedX+DemoX+DemoCourse+type@vertical+block@8fcb212dfd4c48afb62e0b04edc8d4fe

Although the next button from a normal subsection to a gated one is also formed by adding the /first

http://apps.local.openedx.io/learning/course/course-v1:OpenedX+DemoX+DemoCourse/block-v1:OpenedX+DemoX+DemoCourse+type@sequential+block@7bbcf252a0f840a3b11672d9caaa7631/first

However, in the redirection the vertical URL is not being added, but rather it is staying at the sequential URL

http://apps.local.openedx.io/learning/course/course-v1:OpenedX+DemoX+DemoCourse/block-v1:OpenedX+DemoX+DemoCourse+type@sequential+block@7bbcf252a0f840a3b11672d9caaa7631

What I imagine is that when a subsection is gated, the API does not return the units when you move towards it using the navigation buttons, which does happen when you click on the side menu, since these are supposed to be blocked and are not required to be rendered, so it does not allow the correct redirection URL to be formed and for this reason it does not know where it is in the course outline and cannot render the correct URLs in the navigation buttons.

Currently, we continue reviewing the code to verify the hypothesis 100%.

We will continue to notify you about progress in this same way.

CC @magajh

jignaciopm avatar Dec 19 '24 02:12 jignaciopm

Second update

After several tests, I have found the root problem, and it is not 100% related to the MFE.

In the video posted by @mariajgrimaldi it is seen that:

  1. If I try to go to the previous unit right before the gated subsection, the sequence buttons stop working for some reason.
  2. If from the sidebar I try entering one of the units in the gated subsection, and the previous button works.

Point openedx/wg-build-test-release#2 occurs because when a drive is selected from the sidebar, it already contains the absolute URL to the drive in question:

Image

This means that once inside the unit with "prerequisite" and clicking on the "previous" button, the MFE has sufficient context to be able to redirect to the previous section by adding /last to the end of the URL accompanied by the sequentialId, that is, something like: /learning/course/course-v1:edunext+CS101+2014_T1/block-v1:edunext+CS101+2014_T1+type@sequential+block@167a57e59b754f2891b86bb6ec99e7ac/last (Button previous 100% functional)

Now, point openedx/wg-build-test-release#1 occurs because when you use the "next" button to go to the section with "prerequisite", the URL that is generated is /course-id/sequential-id/first and at this point the MFE looks for the units associated with the sequential-id to take the first one and replace it with the path /first, but this does not happen because the endpoint http://local.openedx.io:8000/api/courseware/sequence/block-v1:edunext+CS101+2014_T1+type@sequential+block@8ce633b14c1c407198e1b3208369343e It is returning the element items which are the units as empty:

Image

When the section is not configured as a "prerequisite" you can see that the endpoints respond to the items element correctly:

Image

Now what I will do is check why the service will return the empty items element if it truly has units configured.

jignaciopm avatar Feb 10 '25 06:02 jignaciopm

We're managing this error here: https://github.com/openedx/edx-platform/issues/36826

mariajgrimaldi avatar May 30 '25 15:05 mariajgrimaldi