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

Conditional availability: Enhancements including OR conditions, plugins

    Details

    • Testing Instructions:
      Hide

      UPGRADE TESTING

      The upgrade cannot easily be included in automated tests (the key function is included in a unit test, but that doesn't test the full process) and it is very important that it works, so I am writing a manual test script.

      1. You need a Moodle 2.6 install.

      • This could be a fresh install e.g. using new prefix.
      • Or it could be an existing install if you don't mind upgrading it to 2.7.
      • Alternatively, you can also use a Moodle 2.7 install prior to this change
        landing. Key point is that you must not have yet run the database update
        that comes with this change.

      2. In this Moodle 2.6 install, turn on the following options:

      • enablecompletion
      • enableavailability
      • enablegroupmembersonly (this one is on the experimental settings page)

      3. Restore the attached backup 'revised-26-backup.mbz' to a new course using default settings.

      4. Upgrade your Moodle 2.6 install to Moodle 2.7 including this change.

      EXPECTED: As part of the System upgrade, you should see a progress bar as it updates availability settings.

      5. Check the availability settings for each activity and topic as follows. You can do some of this just by looking at the page with editing on, but for at least a few of them, I suggest double-checking on the editing screen.

      In each case the top-level conditions should be an AND group (which doesn't display in the interface except for cases when there's more than one). The 'shown/hidden' in brackets refers to the action taken when that condition fails, i.e. 'hidden' = hidden completely from users who don't meet the condition and 'shown' = shown greyed out with a message.

      NOTE: Times are from Europe/London timezone, may vary if user has other timezone.

      Page with FROM date (2024)

      • Date >= 10 March 2024 00:00 (shown)

      Page with UNTIL date (March 5)

      • Date < 5 March 2014 00:00(hidden)

      Page with FROM and UNTIL (not shown)

      • Date >= 10 December 2015 00:00 (shown)
      • Date < 4 March 2020 00:00 (hidden)

      Quiz grade >= 75%

      • 'Quiz for grade' score is >= 75%. (shown)

      Quiz grade < 25%

      • 'Quiz for grade' score is < 25%. (shown)

      Quiz grade 50-60%

      • 'Quiz for grade' score is >=50 and <60%. (shown)

      Email contains frog

      • Email address contains frog. (shown)

      Tickbox ticked

      • Page with tickbox is marked complete. (shown)

      Quiz complete but failed

      • Quiz for grade is complete and failed. (shown)

      Quiz complete and passed

      • Quiz for grade is complete and passed. (shown)

      Quiz not complete

      • Quiz for grade is incomplete (shown)

      Grouping Page

      • (Not in availability system, but: groupmembersonly is turned on and 'Example grouping' selected)

      All the options!

      • Date >= 4 March 2017 00:00 (shown)
      • Date < 4 March 2024 00:00 (hidden)
      • Score in Quiz for grade >= 30 and <35% (shown)
      • Score in Course total >= 5 and <10% (shown)
      • Page with tickbox is complete (shown)
      • Quiz for grade is incomplete (shown)
      • City/town contains Frogtown. (shown)
      • Email address contains @ (shown)
      • (Not in availability system, but: groupmembersonly is turned on and 'Example grouping' selected)

      Group forum (group members only)

      • (Not in availability system, but: groupmembersonly is turned on, no grouping)

      Topic with lots of conditions

      • Date >= 5 December 2014 00:00 (hidden)
      • Page with tickbox is complete (hidden)
      • Quiz for grade >= 20% (hidden)
      • Email address contains @ (hidden)

      Topic with grouping (works slightly differently)

      • Grouping: Example grouping (hidden)

      PERFORMANCE

      • Use the "Make a test course feature" to create an M sized course
      • Add conditional activities to 50 activities
      • Login as a student and time the course page loading time
      • Disable the conditional access feature and compare the course page load time
      Show
      UPGRADE TESTING The upgrade cannot easily be included in automated tests (the key function is included in a unit test, but that doesn't test the full process) and it is very important that it works, so I am writing a manual test script. 1. You need a Moodle 2.6 install. This could be a fresh install e.g. using new prefix. Or it could be an existing install if you don't mind upgrading it to 2.7. Alternatively, you can also use a Moodle 2.7 install prior to this change landing. Key point is that you must not have yet run the database update that comes with this change. 2. In this Moodle 2.6 install, turn on the following options: enablecompletion enableavailability enablegroupmembersonly (this one is on the experimental settings page) 3. Restore the attached backup 'revised-26-backup.mbz' to a new course using default settings. 4. Upgrade your Moodle 2.6 install to Moodle 2.7 including this change. EXPECTED: As part of the System upgrade, you should see a progress bar as it updates availability settings. 5. Check the availability settings for each activity and topic as follows. You can do some of this just by looking at the page with editing on, but for at least a few of them, I suggest double-checking on the editing screen. In each case the top-level conditions should be an AND group (which doesn't display in the interface except for cases when there's more than one). The 'shown/hidden' in brackets refers to the action taken when that condition fails, i.e. 'hidden' = hidden completely from users who don't meet the condition and 'shown' = shown greyed out with a message. NOTE: Times are from Europe/London timezone, may vary if user has other timezone. Page with FROM date (2024) Date >= 10 March 2024 00:00 (shown) Page with UNTIL date (March 5) Date < 5 March 2014 00:00(hidden) Page with FROM and UNTIL (not shown) Date >= 10 December 2015 00:00 (shown) Date < 4 March 2020 00:00 (hidden) Quiz grade >= 75% 'Quiz for grade' score is >= 75%. (shown) Quiz grade < 25% 'Quiz for grade' score is < 25%. (shown) Quiz grade 50-60% 'Quiz for grade' score is >=50 and <60%. (shown) Email contains frog Email address contains frog. (shown) Tickbox ticked Page with tickbox is marked complete. (shown) Quiz complete but failed Quiz for grade is complete and failed. (shown) Quiz complete and passed Quiz for grade is complete and passed. (shown) Quiz not complete Quiz for grade is incomplete (shown) Grouping Page (Not in availability system, but: groupmembersonly is turned on and 'Example grouping' selected) All the options! Date >= 4 March 2017 00:00 (shown) Date < 4 March 2024 00:00 (hidden) Score in Quiz for grade >= 30 and <35% (shown) Score in Course total >= 5 and <10% (shown) Page with tickbox is complete (shown) Quiz for grade is incomplete (shown) City/town contains Frogtown. (shown) Email address contains @ (shown) (Not in availability system, but: groupmembersonly is turned on and 'Example grouping' selected) Group forum (group members only) (Not in availability system, but: groupmembersonly is turned on, no grouping) Topic with lots of conditions Date >= 5 December 2014 00:00 (hidden) Page with tickbox is complete (hidden) Quiz for grade >= 20% (hidden) Email address contains @ (hidden) Topic with grouping (works slightly differently) Grouping: Example grouping (hidden) PERFORMANCE Use the "Make a test course feature" to create an M sized course Add conditional activities to 50 activities Login as a student and time the course page loading time Disable the conditional access feature and compare the course page load time
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-44070-master

      Description

      I propose to make major improvements to the conditional availability system.

      Key improvements:

      • Support for OR and NOT conditions (current system only does AND) and condition trees.
      • Improved user interface using JavaScript.
      • Support for pluggable restrictions instead of the current hardcoded options (date, grade, etc).
      • Tidy up 'grouping' feature - currently used both for grouped activities (to select a set of groups) and also as a restriction - to separate these functions.
      • Behaviour is intended to be fully backward-compatible via database upgrade. I also intend for public API functions to continue working (although possibly with deprecation/name changes).

      Out of scope:

      • This enhancement is strictly related to conditional activity/section availability (the system controlled by $CFG->enableavailability). For example, there will be no changes to the activity or course completion system at this point.

      Please see the attached Word document for a detailed explanation of planned changes.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  32 Vote for this issue
                  Watchers:
                  24 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/May/14