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

Improve install and uninstall procedure Analytics API offered to plugins

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requirements

      • Ability to install an old Moodle version and upgrade it
      • Ability to edit the code prior the upgrade

      Core installation test

      Scenario: A fresh 3.7 installation has both in-built models installed.

      1. Install a fresh 3.7 site with the patch included
      2. Go to Site administration > Analytics > Analytics models
      3. TEST: Check that there are "No teaching" and "Students at risk of dropping out" enlisted
      4. TEST: Check that the "No teaching" model is enabled by default and the other one is disabled by default.

      Core upgrade test

      Scenario: Moodle 3.3 site upgraded to 3.7 has both in-built models installed.

      1. Install a fresh 3.3 site
      2. Upgrade it directly to the patched 3.7 site
      3. Go to Site administration > Analytics > Analytics models
      4. TEST: Check that there are "No teaching" and "Students at risk of dropping out" enlisted
      5. TEST: Check that the "No teaching" model is enabled by default and the other one is disabled by default.

      Plugin install test

      Scenario: Models declared by a plugin are created on plugin installation

      1. Install a fresh 3.7 site with the patch included
      2. Install the plugin https://github.com/mudrd8mz/moodle-local_testanalytics/tree/MDL-61667-37-demo (make sure to use this particular branch with the db/analytics.php file)
      3. Go to Site administration > Analytics > Analytics models
      4. TEST: Check that all the 6 models (e.g. "Linear", "Discreate", ...) declared by the plugin are created
      5. TEST: Check that out of those, only models aiming the example target "Binary", "Linear" and "Discrete" are enabled. All others like "Users without pic" are disabled even if they have a time-splitting method configured.

      Missing default models

      Scenario: Missing default models are automatically re-created

      1. Install a fresh 3.7 site with the patch included
      2. Go to Site administration > Analytics > Analytics models
      3. Delete the "No teaching" model
      4. Edit the main version.php and increase the version number
      5. Visit the admin notifications page to trigger the core upgrade
      6. Go to Site administration > Analytics > Analytics models
      7. TEST: Check that there the "No teaching" model has been re-created
      8. TEST: Check that the "No teaching" model is marked as enabled

      Customised default models

      Scenario: Customised default models aiming the same target are not duplicated

      1. Install a fresh 3.7 site with the patch included
      2. Go to Site administration > Analytics > Analytics models
      3. Edit the "Students at risk of dropping out" model
      4. Remove most of the selected indicators, keeping just a few of them
      5. Edit the main version.php and increase the version number
      6. Visit the admin notifications page to trigger the core upgrade
      7. Go to Site administration > Analytics > Analytics models
      8. TEST: Check that the "Students at risk of dropping out" model is there just once (no new model aiming the same target has been created)
      9. TEST: Check that the "Students at risk of dropping out" model has only the indicators that you left there after editing - the list of indicators was not reset to the default value.
      Show
      Requirements Ability to install an old Moodle version and upgrade it Ability to edit the code prior the upgrade Core installation test Scenario: A fresh 3.7 installation has both in-built models installed. Install a fresh 3.7 site with the patch included Go to Site administration > Analytics > Analytics models TEST : Check that there are "No teaching" and "Students at risk of dropping out" enlisted TEST : Check that the "No teaching" model is enabled by default and the other one is disabled by default. Core upgrade test Scenario: Moodle 3.3 site upgraded to 3.7 has both in-built models installed. Install a fresh 3.3 site Upgrade it directly to the patched 3.7 site Go to Site administration > Analytics > Analytics models TEST : Check that there are "No teaching" and "Students at risk of dropping out" enlisted TEST : Check that the "No teaching" model is enabled by default and the other one is disabled by default. Plugin install test Scenario: Models declared by a plugin are created on plugin installation Install a fresh 3.7 site with the patch included Install the plugin https://github.com/mudrd8mz/moodle-local_testanalytics/tree/MDL-61667-37-demo (make sure to use this particular branch with the db/analytics.php file) Go to Site administration > Analytics > Analytics models TEST : Check that all the 6 models (e.g. "Linear", "Discreate", ...) declared by the plugin are created TEST : Check that out of those, only models aiming the example target "Binary", "Linear" and "Discrete" are enabled. All others like "Users without pic" are disabled even if they have a time-splitting method configured. Missing default models Scenario: Missing default models are automatically re-created Install a fresh 3.7 site with the patch included Go to Site administration > Analytics > Analytics models Delete the "No teaching" model Edit the main version.php and increase the version number Visit the admin notifications page to trigger the core upgrade Go to Site administration > Analytics > Analytics models TEST : Check that there the "No teaching" model has been re-created TEST : Check that the "No teaching" model is marked as enabled Customised default models Scenario: Customised default models aiming the same target are not duplicated Install a fresh 3.7 site with the patch included Go to Site administration > Analytics > Analytics models Edit the "Students at risk of dropping out" model Remove most of the selected indicators, keeping just a few of them Edit the main version.php and increase the version number Visit the admin notifications page to trigger the core upgrade Go to Site administration > Analytics > Analytics models TEST : Check that the "Students at risk of dropping out" model is there just once (no new model aiming the same target has been created) TEST : Check that the "Students at risk of dropping out" model has only the indicators that you left there after editing - the list of indicators was not reset to the default value.
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61667-master-modelsinstall

      Description

      Hey David,

      we just tried your Analytics API in a spontaneous DevCamp on the MoodleMootDE 2018 and completed a first small prototype for a new built-in model. First, thanks for your amazing work there.

      In the progress of the DevCamp, I stumbled over the way, plugins need to install built-in models within a plugin. As also done within your moodle-tool_testanalytics, you need to specify the installation as documented at MoodleDocs within db/install.php. However, this is not  the way other APIs define built-in stuff. Examples that came to my mind are the tasks API, where you specify an array within db/tasks.php or the services API with db/services.php, respectively.

      I would suggest adding an additional db file such as db/models.php or db/analytics.php for an easy definition of built-in models. The core analytics plugin would have to parse this file and would care about the installation, update and removal of built-in models.

      I have not fought about concrete implementation details yet and first wanted to hear, what you think about this idea.

      Cheers,

      Tobias

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 25 minutes
                  2h 25m