Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28967 Categories intermittently disappearing from Navigation block's "Courses" list
  3. MDL-32267

Categories intermittently disappearing from Navigation block's "Courses" list - solution for master

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.3
    • 2.3
    • Navigation
    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • wip-MDL-32267-m23
    • Difficult
    • Hide

      Set up

      1. Put the navigationtestsetup.php script into your moodle directory
      2. Log in as an admin and set navcourselimit to 5
      3. Add the following to your config.php file immediately above the inclusion of setup.php

      if (array_key_exists('showcategories', $_GET)) {
          $CFG->navshowcategories = (bool)$_GET['showcategories'];
      }
      if (array_key_exists('showallcourses', $_GET)) {
          $CFG->navshowallcourses = (bool)$_GET['showallcourses'];
      }

      4. Install a fresh site
      5. In your browser open a new tab and visit yousite.local/navigationtestsetup.php. When its done you can close the tab.
      6. Check you have the structure in the reference below
      7. Browse to course 10 and enable guest access
      8. Take note of the id for course 10 where ever I use %C10% substitute it.
      9. Take note of the id for category 4 where ever I user %C4% substitute it.
      10. Optional but I find it helps change front page settings to show just the combo list for logged in and logged out users
      11. Log out

      Reference 1: Test site structure
      This is the structure that the test script set up.
      Take note of this structure you will be referring to it.

      Category 1
       -> Category 2
           -* Course 15
           -* Course 16
           -* Course 17
           -* Course 18
           -* Course 19
       -> Category 3
           -* Course 7
           -* Course 8
       -> Category 4
       -> Category 5
            -> Category 6
                -* Course 9
                -* Course 10
                -* Course 11
                -* Course 12
                -* Course 13
                -* Course 14
       -* Course 1
       -* Course 2
       -* Course 3
       -* Course 4
       -* Course 5
       -* Course 6
      Category 7
       -> Category 8
       -> Category 9
       -> Category 10
      Category 11
       -* Course 20
       -* Course 21
       -* Course 22
       -* Course 23
       -* Course 24
       -* Course 25
       -* Course 26

      Reference 2: User access structure
      The test script also created three users and enrolled then in courses.
      *User 1:

        • username: navigationuser1
        • password: navigationuser1
        • courses: All courses
          *User 2:
        • username: navigationuser2
        • password: navigationuser2
        • courses: 1,2,3,13,14,16,18,20,21,22,23,24,25,26
          *User 3:
        • username: navigationuser3
        • password: navigationuser3
        • courses: None

      Please note for all of these tests the setting navcourselimit is going to be left at 5
      Please ensure that categories with more than 5 courses show a "View all courses" link and
      that categories with 5 or less courses do not.
      There is one exception to this, when viewing a course in a category with more than 5 courses you may end up with 6 courses being shown.
      This is because the course you are viewing is not one of the first 5 courses in the category and was loaded after the category content.
      I will file a bug for this, it has very little impact so I don't see a problem with this approach.

      Test 1: Guest front page generation

      1. Log in as a guest
      2. Browse to yoursite.local/?showcategories=1&showallcourses=1
        • Using developer tool watch AJAX requests and make sure they don't occur when expanding categories we know have content
        • Check you see a courses link in the navigation that can be expanded
        • Expand the courses link and you should see the start of the structure (categories 1, 7, and 11)
        • Expand all of the categories and check you can see the whole structure
      3. Browse to yoursite.local/?showcategories=1&showallcourses=0
        • Using developer tool watch AJAX requests and make sure they are used to load categories after the root categories (1,7,11)
        • Check you see a courses link in the navigation that can be expanded
        • Expand the courses link and you should see the start of the structure (categories 1, 7, and 11)
        • Expand all of the categories and check you can see the whole structure
      4. Browse to yoursite.local/?showcategories=0&showallcourses=0
        • Check you see a courses link in the navigation that can be expanded
        • Expand the courses link and you should see the 5 courses plus a View all courses and categories link
      5. Browse to yoursite.local/?showcategories=0&showallcourses=1
        • Check you see a courses link in the navigation that can be expanded
        • Expand the courses link and you should see the 5 courses plus a View all courses and categories link

      Test 2: Guest category page generation
      Please note that when viewing a category the navigation always generates categories.
      This makes more sense from a usability point of view and helps ensure categories
      are generated correctly.

      1. Log in as a guest
      2. Browse to yoursite.local/course/category.php?id=%C4%&showcategories=1&showallcourses=1
        • Check you see the structure with course and categories
        • Check Category 4 has been highlighted
        • Expand all the categories and make sure you see the full structure as above with test 1.1
      3. Browse to yoursite.local/course/category.php?id=%C4%&showcategories=1&showallcourses=0 and repeat the above checks
      4. Browse to yoursite.local/course/category.php?id=%C4%&showcategories=0&showallcourses=0 and repeat the above checks
      5. Browse to yoursite.local/course/category.php?id=%C4%&showcategories=0&showallcourses=1 and repeat the above checks

      Test 3: Guest course page generation

      1. Log in as a guest
      2. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=1
        • Check that the navigation has generated courses and categories
        • Check that course 10 has been highlighted
        • Expand all categories and check you can see the full structure
      3. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=0 and repeat the above checks
      4. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=0
        • Check the navigation generated courses but not categories
        • Check that navigation for course 10 was generated and the course highlighted.
      5. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=1 and repeat the above checks

      Test 4: User who is not enrolled in any courses

      1. Repeat tests 1, 2, and 3 but log in as User 3 this time. The outcome for all tests should be the same
      2. If you are really keen repeat this again but logged in as the admin (ensuring they are not enrolled in any courses)

      Test 5: User who is enrolled in all courses

      1. Log in as as user 1
      2. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=1
        • Check that you get a My courses branch that contains all of the courses from the structure (but no categories)
        • Check that course 10 is highlighted
        • Check that you have a Course branch that shows the base categories when expanded
        • Expand all of the categories under Courses and check you can see the whole structure
        • Find course 10 in the courses branch and make sure it is not highlighted
      3. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=0
        • Check that you get a My courses branch that contains all of the courses from the structure (but no categories)
        • Check that course 10 is highlighted
        • Check that you don't have a courses branch
      4. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=0 and repeat the above tests
      5. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=1
        • Check that you get a My courses branch that contains all of the courses from the structure (but no categories)
        • Check that you get a Courses branch that contains all of the courses from the structure (but no categories)
        • Check that course 10 is highlighted
        • Find course 10 in the courses branch and make sure it is not highlighted

      Test 6: User who is enrolled in some courses

      1. Log in as an admin and check that user 2 is not enrolled in course 10 (unenrol them if they are)
      2. Log in as as user 2
      3. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=1
        • Check that you see a My course branch but that it is not expanded
        • Check that you see a Courses branch that is expanded and course 10 is highlighted
        • Expand all of the categories under Courses and check you can see the whole structure
      4. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=0 and repeat the above steps
      5. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=0
        • Check that you see a My course branch but that it is not expanded
        • Check that you see a courses branch containing just Course 10
      6. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=1
        • Check that you see a My course branch but that it is not expanded
        • Check that you see a courses branch containing all of the courses
        • Check that Course 10 is highlighted

      Done!

      Show
      Set up 1. Put the navigationtestsetup.php script into your moodle directory 2. Log in as an admin and set navcourselimit to 5 3. Add the following to your config.php file immediately above the inclusion of setup.php if (array_key_exists('showcategories', $_GET)) { $CFG->navshowcategories = (bool)$_GET['showcategories']; } if (array_key_exists('showallcourses', $_GET)) { $CFG->navshowallcourses = (bool)$_GET['showallcourses']; } 4. Install a fresh site 5. In your browser open a new tab and visit yousite.local/navigationtestsetup.php. When its done you can close the tab. 6. Check you have the structure in the reference below 7. Browse to course 10 and enable guest access 8. Take note of the id for course 10 where ever I use %C10% substitute it. 9. Take note of the id for category 4 where ever I user %C4% substitute it. 10. Optional but I find it helps change front page settings to show just the combo list for logged in and logged out users 11. Log out Reference 1: Test site structure This is the structure that the test script set up. Take note of this structure you will be referring to it. Category 1 -> Category 2 -* Course 15 -* Course 16 -* Course 17 -* Course 18 -* Course 19 -> Category 3 -* Course 7 -* Course 8 -> Category 4 -> Category 5 -> Category 6 -* Course 9 -* Course 10 -* Course 11 -* Course 12 -* Course 13 -* Course 14 -* Course 1 -* Course 2 -* Course 3 -* Course 4 -* Course 5 -* Course 6 Category 7 -> Category 8 -> Category 9 -> Category 10 Category 11 -* Course 20 -* Course 21 -* Course 22 -* Course 23 -* Course 24 -* Course 25 -* Course 26 Reference 2: User access structure The test script also created three users and enrolled then in courses. *User 1: username: navigationuser1 password: navigationuser1 courses: All courses *User 2: username: navigationuser2 password: navigationuser2 courses: 1,2,3,13,14,16,18,20,21,22,23,24,25,26 *User 3: username: navigationuser3 password: navigationuser3 courses: None Please note for all of these tests the setting navcourselimit is going to be left at 5 Please ensure that categories with more than 5 courses show a "View all courses" link and that categories with 5 or less courses do not. There is one exception to this, when viewing a course in a category with more than 5 courses you may end up with 6 courses being shown. This is because the course you are viewing is not one of the first 5 courses in the category and was loaded after the category content. I will file a bug for this, it has very little impact so I don't see a problem with this approach. Test 1: Guest front page generation Log in as a guest Browse to yoursite.local/?showcategories=1&showallcourses=1 Using developer tool watch AJAX requests and make sure they don't occur when expanding categories we know have content Check you see a courses link in the navigation that can be expanded Expand the courses link and you should see the start of the structure (categories 1, 7, and 11) Expand all of the categories and check you can see the whole structure Browse to yoursite.local/?showcategories=1&showallcourses=0 Using developer tool watch AJAX requests and make sure they are used to load categories after the root categories (1,7,11) Check you see a courses link in the navigation that can be expanded Expand the courses link and you should see the start of the structure (categories 1, 7, and 11) Expand all of the categories and check you can see the whole structure Browse to yoursite.local/?showcategories=0&showallcourses=0 Check you see a courses link in the navigation that can be expanded Expand the courses link and you should see the 5 courses plus a View all courses and categories link Browse to yoursite.local/?showcategories=0&showallcourses=1 Check you see a courses link in the navigation that can be expanded Expand the courses link and you should see the 5 courses plus a View all courses and categories link Test 2: Guest category page generation Please note that when viewing a category the navigation always generates categories. This makes more sense from a usability point of view and helps ensure categories are generated correctly. Log in as a guest Browse to yoursite.local/course/category.php?id=%C4%&showcategories=1&showallcourses=1 Check you see the structure with course and categories Check Category 4 has been highlighted Expand all the categories and make sure you see the full structure as above with test 1.1 Browse to yoursite.local/course/category.php?id=%C4%&showcategories=1&showallcourses=0 and repeat the above checks Browse to yoursite.local/course/category.php?id=%C4%&showcategories=0&showallcourses=0 and repeat the above checks Browse to yoursite.local/course/category.php?id=%C4%&showcategories=0&showallcourses=1 and repeat the above checks Test 3: Guest course page generation Log in as a guest Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=1 Check that the navigation has generated courses and categories Check that course 10 has been highlighted Expand all categories and check you can see the full structure Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=0 and repeat the above checks Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=0 Check the navigation generated courses but not categories Check that navigation for course 10 was generated and the course highlighted. Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=1 and repeat the above checks Test 4: User who is not enrolled in any courses Repeat tests 1, 2, and 3 but log in as User 3 this time. The outcome for all tests should be the same If you are really keen repeat this again but logged in as the admin (ensuring they are not enrolled in any courses) Test 5: User who is enrolled in all courses Log in as as user 1 Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=1 Check that you get a My courses branch that contains all of the courses from the structure (but no categories) Check that course 10 is highlighted Check that you have a Course branch that shows the base categories when expanded Expand all of the categories under Courses and check you can see the whole structure Find course 10 in the courses branch and make sure it is not highlighted Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=0 Check that you get a My courses branch that contains all of the courses from the structure (but no categories) Check that course 10 is highlighted Check that you don't have a courses branch Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=0 and repeat the above tests Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=1 Check that you get a My courses branch that contains all of the courses from the structure (but no categories) Check that you get a Courses branch that contains all of the courses from the structure (but no categories) Check that course 10 is highlighted Find course 10 in the courses branch and make sure it is not highlighted Test 6: User who is enrolled in some courses Log in as an admin and check that user 2 is not enrolled in course 10 (unenrol them if they are) Log in as as user 2 Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=1 Check that you see a My course branch but that it is not expanded Check that you see a Courses branch that is expanded and course 10 is highlighted Expand all of the categories under Courses and check you can see the whole structure Browse to yoursite.local/course/view.php?id=%C10%&showcategories=1&showallcourses=0 and repeat the above steps Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=0 Check that you see a My course branch but that it is not expanded Check that you see a courses branch containing just Course 10 Browse to yoursite.local/course/view.php?id=%C10%&showcategories=0&showallcourses=1 Check that you see a My course branch but that it is not expanded Check that you see a courses branch containing all of the courses Check that Course 10 is highlighted Done!

      I have created this sub task to track the integration of a fix for MDL-28967 in the master branch.
      There is also a separate issue to backport those changes to Moodle 2.2+ and Moodle 2.1+ once they have been integrated on the master branch and time has passed to ensure any regressions or problems have been weeded out.

            samhemelryk Sam Hemelryk
            samhemelryk Sam Hemelryk
            Ankit Agarwal Ankit Agarwal
            Dan Poltawski Dan Poltawski
            Rajesh Taneja Rajesh Taneja
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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