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

fix: update prereq state for all #64

Draft
wants to merge 1 commit into
base: asu-moe/redwood-css
Choose a base branch
from

Conversation

DanielVZ96
Copy link
Member

@DanielVZ96 DanielVZ96 commented Aug 31, 2024

Prerequisites don't update for all sections when a subsection is set as prerequisite, only for its own section. This is because the prerequisites list is part of the state of each configure modal instead of the global state. Because of this, when prerequisites change (and sections), the whole course outline state needs to be reloaded.

Here's a video of the issue:

Screencast.from.09-03-2024.05.51.58.PM.webm

Testing instructions

0. setup tutor

  • If you have tvm you can use it: tvm project init tutor-eshe v18.1.3 && cd tutor-eshe && source .tvm/bin/activate
  • Add a plugin to config MFE. Create the file inside tutor-eshe/plugins/mfe_config.yml and th
name: mfe_config
version: 0.1.0
patches:
  mfe-lms-common-settings: |
    MFE_CONFIG.update({
        "PARAGON_THEME_URLS": {
            "core": {
                "urls": {
                    "default": "https://cdn.jsdelivr.net/npm/@openedx/paragon@23.0.0-alpha.1/dist/core.min.css",
                    "brandOverride": "https://cdn.jsdelivr.net/npm/@edx/brand-edx.org@2.2.0-alpha.17/dist/core.min.css"
                }
            },
            "variants": {
                "light": {
                    "urls": {
                        "default": "https://cdn.jsdelivr.net/npm/@openedx/paragon@23.0.0-alpha.1/dist/light.min.css",
                        "brandOverride": "https://eshe-themes-static-files.s3.me-south-1.amazonaws.com/css/core.min.css"
                    },
                    "default": True,
                    "dark": False
                }
            }
        }
    })
  • And then install all required plugins
tutor plugins update && tutor plugins install mfe && tutor plugins enable mfe_config
  • Clone this branch and add to the mounts with tutor mounts add frontend-app-course-authoring
  • Start the instance with tutor dev launch
  • Import the demo course with tutor dev do importdemocourse
  • Create a staff user with tutor dev do createuser --staff --superuser staff staff@example.com -p staff

Test

  • Login and go to the demo course in studio
  • For any subsection, in the advanced tab, check the box for letting the subsection be a prerequisite
  • After it's saved, check the advanced tab for a subsection from another section, and assert that in the dropdown for selecting prerequisites, the subsection from the previous step appears.

@@ -187,7 +187,9 @@ const useCourseOutline = ({ courseId }) => {
dispatch(configureCourseSectionQuery(currentSection.id, ...arg));
break;
case COURSE_BLOCK_NAMES.sequential.id:
dispatch(configureCourseSubsectionQuery(currentItem.id, currentSection.id, ...arg));
dispatch(configureCourseSubsectionQuery(currentItem.id, currentSection.id, ...arg)).then(() => {
dispatch(fetchCourseOutlineIndexQuery(courseId));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will reload all sections after a subsection is updated. fixes the issue, but I think there could be a more elegant solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant