Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66780

Hiding a section makes it show, in specific circumstances

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.4.9, 3.5.13, 3.7.7, 3.8.4, 3.9.1, 3.9.18, 3.10, 3.11.11, 4.0.5, 4.0.11, 4.1, 4.1.6, 4.2.3, 4.3, 4.4.5, 5.0
    • Course
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE, MOODLE_404_STABLE, MOODLE_500_STABLE
    • mdl-66780_404
    • mdl-66780_405
    • mdl-66780_main
    • Hide
      1. Create a new Custom sections format course with at least one section.
      2. Set Course settings > Course format > Hidden sections to "Hiden sections are shown as not available", and save.
      3. Turn editing on.
      4. Set Section 1 settings > Restrict access > Access restrictions to something unavailable, such as "Must match Date until 1 January 2000", set the availability eye icon to "Hidden entirely if student doesn't meet this condition", and save.
      5. Return to the course page.
      6. Set Section 1 to be shown (if it isn't already).
      7. Switch role to student.
      8. Verify Section 1 is hidden entirely.
      9. Return to normal role.
      10. Turn editing on.
      11. Set Section 1 to be hidden.
      12. Switch role to student.
      13. Verify Section 1 is hidden entirely. [This fails before the patch.]
      14. Return to normal role.
      15. Turn editing on.
      16. Set Section 1 settings > Restrict access > Access restrictions > availability eye icon to "Displayed if student doesn't meet this condition", and save.
      17. Return to the course page.
      18. Switch role to student.
      19. Verify the Section 1 heading is visible.
      20. Verify the Section 1 section availability information reads "Not available", with no further information.
      Show
      Create a new Custom sections format course with at least one section. Set Course settings > Course format > Hidden sections to "Hiden sections are shown as not available", and save. Turn editing on. Set Section 1 settings > Restrict access > Access restrictions to something unavailable, such as "Must match Date until 1 January 2000", set the availability eye icon to "Hidden entirely if student doesn't meet this condition", and save. Return to the course page. Set Section 1 to be shown (if it isn't already). Switch role to student. Verify Section 1 is hidden entirely. Return to normal role. Turn editing on. Set Section 1 to be hidden. Switch role to student. Verify Section 1 is hidden entirely. [This fails before the patch.] Return to normal role. Turn editing on. Set Section 1 settings > Restrict access > Access restrictions > availability eye icon to "Displayed if student doesn't meet this condition", and save. Return to the course page. Switch role to student. Verify the Section 1 heading is visible. Verify the Section 1 section availability information reads "Not available", with no further information.
    • Hide

      Code verified against automated checks.

      Checked MDL-66780 using repository: https://github.com/james-cnz/moodle

      More information about this report

      Built on: Mon 09 Dec 2024 08:29:12 PM UTC

      Show
      Code verified against automated checks. Checked MDL-66780 using repository: https://github.com/james-cnz/moodle MOODLE_404_STABLE (0 errors / 0 warnings) [branch: mdl-66780_404 | CI Job ] MOODLE_405_STABLE (0 errors / 0 warnings) [branch: mdl-66780_405 | CI Job ] main (0 errors / 0 warnings) [branch: mdl-66780_main | CI Job ] More information about this report Built on: Mon 09 Dec 2024 08:29:12 PM UTC

      FULL STEPS

      With a given course and section:

      Set the course setting "Format" to "Custom sections" or "Weekly sections".
      Set the course setting "Hidden sections" to "Hidden sections are shown as not available".

      Turn editing on.
      Set the section setting "Access restrictions" to something unavailable, e.g. "Must match Date until 1 January 2000".
      Set the section setting "Access restrictions" visibility to "Hidden entirely if user does not meet this condition".

      Ensure the section is set to show.
      Switch role to Student.
      The section does not appear.

      Return to normal role.
      Turn editing on.
      Set the section to hidden.
      Switch role to Student again.
      The section now does appear.

      WHAT I EXPECTED

      Hiding a section should not make it show under any circumstances.

      WHAT ACTUALLY HAPPENS

      Hiding a section does make it show in specific circumstances.

      TO FIX

      In course/format/classes/base.php function is_section_visible(),
      change:

      return $section->uservisible ||
      ($section->visible && !$section->available && !empty($section->availableinfo)) ||
      (!$section->visible && !$hidesections);

      to:

      return $section->uservisible ||
      ($section->visible || !$hidesections)
      && ($section->available || !empty($section->availableinfo));

            james-cnz James E. Calder
            james-cnz James E. Calder
            Sumaiya Javed Sumaiya Javed
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 minute
                1m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.