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

Create a new model for upcoming activities due

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisites

      1. Log in as admin
      2. Go to site admin > language > language packs
      3. Install the French language pack
      4. Go to site admin > language > language customization
      5. Edit French
      6. Select analytics.php for Show strings of these components and 'viewinsight' for String identifier. Press Show strings
      7. Set the string text to Voir l'insight and press Save changes to the language pack, confirming the changes
      8. Create a manager user and assign him to 'manager' role at system level
      9. Go to the manager user profile page and click on Preferences > Preferred language. Select "Français" and save changes.
      10. Set up 2 courses so that:
        1. user1 and user2 are enrolled as students in course1
        2. user2 preferred language is Français
        3. user3 is enrolled in course2 and only in course2, no other course enrolments (this is only to avoid possible misinterpretations of the results as we want to check that only some users get notifications)
        4. These 2 courses have no teachers and start tomorrow
      11. Create 1 quiz activity in course1 with time close tomorrow
      12. Create 1 quiz activity in course2 with time close in 10 days
      13. Go to site admin > analytics > analytics models
      14. Click on Actions > Enable for Upcoming activities due model
      15. If No teaching model is not enabled click on Actions > Enable for No teaching model
      16. Go to site admin > analytics > analytics settings and untick onlycli setting

      Test the new model

      1. Go to Administration > Site administration > Server > Scheduled tasks
        1. Find task "Predict models \tool_analytics\task\predict_models"
        2. Click "Run now" (if this is not visible, see https://docs.moodle.org/en/Scheduled_tasks#Running_individual_tasks)
        3. Log will pop up, or check log by clicking the "Page" icon next to the task and click the "Magnifying glass" icon next to the most recent log entry
      2. You SHOULD NOT see any error and the process SHOULD finish fine
      3. Return to the web interface, log in as admin and go to site admin > analytics > analytics models
      4. You SHOULD see a dropdown menu in the Insights column of the Upcoming activities due model
      5. You SHOULD see user1 and user2 listed here. You SHOULD NOT see user3.
      6. Select user1
      7. The page where you are forwarded SHOULD be report/insights/prediction.php
      8. If you expand the Actions drop down menu you SHOULD NOT see a Upcoming events link, and you SHOULD see Acknowledged a Not useful options
      9. Select one of the options, you SHOULD be forwarded to admin/tool/analytics/index.php and user1 SHOULD NOT appear in the Insights list for the Upcoming activities due model anymore
      10. Log in as user2 and check your notifications
      11. The title of the last one SHOULD be You have upcoming activities due (not sure if it will already be marked as read or not, that depends on messaging stuff)
      12. Click on the notification, you SHOULD be forwarded to user2 upcoming calendar events
      13. Execute the following SQL query, one result SHOULD be returned and the userid of the returned records SHOULD be user2 id
        •  select * from mdl_analytics_prediction_actions where actionname = 'viewupcoming'; 

      14. Expand your notifications again and now click on the Afficher la notification complète link in the last notification
      15. You SHOULD see a notification with some suggested actions: Événements à venir, View insight details, Reconnu and Pas utile.
      16. Click on View insight details. You SHOULD be forwarded to report/insights/prediction.php
      17. Open the Actions dropdown. You SHOULD see a Événements à venir option, as well as Reconnu and Pas utile options.
      18. Expand your notifications again and click on the Afficher la notification complète link in the last notification
      19. Now press Reconnu option
      20. You SHOULD be forwarded to user2's dashboard and you SHOULD see a Your action has been saved success notification

      Regression test

      1. Go to site admin > analytics > analytics models
      2. Execute Get predictions for the No teaching model and click Continue once the process finishes
      3. You SHOULD see a dropdown menu in the Insights column of the No teaching model. Select All predictions
      4. You SHOULD be forwarded to report/insights/insights.php
      5. Log in as a manager
      6. Expand your notifications, the title of your last notification SHOULD be Upcoming courses have no teachers or students. Click on the notification, you SHOULD be forwarded to report/insights/insights.php page
      7. Expand your notifications again and now click on the Afficher la notification complète link in the last notification
      8. The notification text SHOULD include a Voir l'insight button. Click on it, you SHOULD be forwarded to the same report/insights/insights.php page.
      9. You SHOULD not see any Prediction: No teaching string
      Show
      Prerequisites Log in as admin Go to site admin > language > language packs Install the French language pack Go to site admin > language > language customization Edit French Select analytics.php for Show strings of these components and 'viewinsight' for String identifier . Press Show strings Set the string text to Voir l'insight and press Save changes to the language pack , confirming the changes Create a manager user and assign him to 'manager' role at system level Go to the manager user profile page and click on Preferences > Preferred language. Select "Français" and save changes. Set up 2 courses so that: user1 and user2 are enrolled as students in course1 user2 preferred language is Français user3 is enrolled in course2 and only in course2, no other course enrolments (this is only to avoid possible misinterpretations of the results as we want to check that only some users get notifications) These 2 courses have no teachers and start tomorrow Create 1 quiz activity in course1 with time close tomorrow Create 1 quiz activity in course2 with time close in 10 days Go to site admin > analytics > analytics models Click on Actions > Enable for Upcoming activities due model If No teaching model is not enabled click on Actions > Enable for No teaching model Go to site admin > analytics > analytics settings and untick onlycli setting Test the new model Go to Administration > Site administration > Server > Scheduled tasks Find task "Predict models \tool_analytics\task\predict_models" Click "Run now" (if this is not visible, see https://docs.moodle.org/en/Scheduled_tasks#Running_individual_tasks ) Log will pop up, or check log by clicking the "Page" icon next to the task and click the "Magnifying glass" icon next to the most recent log entry You SHOULD NOT see any error and the process SHOULD finish fine Return to the web interface, log in as admin and go to site admin > analytics > analytics models You SHOULD see a dropdown menu in the Insights column of the Upcoming activities due model You SHOULD see user1 and user2 listed here. You SHOULD NOT see user3. Select user1 The page where you are forwarded SHOULD be report/insights/prediction.php If you expand the Actions drop down menu you SHOULD NOT see a Upcoming events link, and you SHOULD see Acknowledged a Not useful options Select one of the options, you SHOULD be forwarded to admin/tool/analytics/index.php and user1 SHOULD NOT appear in the Insights list for the Upcoming activities due model anymore Log in as user2 and check your notifications The title of the last one SHOULD be You have upcoming activities due (not sure if it will already be marked as read or not, that depends on messaging stuff) Click on the notification, you SHOULD be forwarded to user2 upcoming calendar events Execute the following SQL query, one result SHOULD be returned and the userid of the returned records SHOULD be user2 id select * from mdl_analytics_prediction_actions where actionname = 'viewupcoming'; Expand your notifications again and now click on the Afficher la notification complète  link in the last notification You SHOULD see a notification with some suggested actions: Événements à venir , View insight details , Reconnu and Pas utile . Click on View insight details . You SHOULD be forwarded to report/insights/prediction.php Open the Actions dropdown. You SHOULD see a Événements à venir  option, as well as Reconnu and Pas utile options. Expand your notifications again and click on the Afficher la notification complète  link in the last notification Now press Reconnu option You SHOULD be forwarded to user2's dashboard and you SHOULD see a Your action has been saved success notification Regression test Go to site admin > analytics > analytics models Execute Get predictions for the No teaching model and click Continue once the process finishes You SHOULD see a dropdown menu in the Insights column of the No teaching model. Select All predictions You SHOULD be forwarded to report/insights/insights.php Log in as a manager Expand your notifications, the title of your last notification SHOULD be Upcoming courses have no teachers or students . Click on the notification, you SHOULD be forwarded to report/insights/insights.php page Expand your notifications again and now click on the Afficher la notification complète  link in the last notification The notification text SHOULD include a Voir l'insight  button. Click on it, you SHOULD be forwarded to the same report/insights/insights.php page. You SHOULD not see any Prediction: No teaching string
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-64783_master

      Description

      This issue is about creating a new static model (based on assumptions, not a predictive model) that looks for upcoming events and generates insights about them. These insights can be seen as reminders. MOOCs offered in platforms like coursera or edX have similar automatic-notification systems.

      We should define when (approximately) these notifications will be executed. A new time splitting method would be required to define when insights will be generated.

      We would also need a new target and a new indicator. The indicator should not be tied to this particular model as it should be reusable across different models (https://docs.moodle.org/dev/Analytics_API#Indicator_.28core_analytics.5Clocal.5Cindicator.5Cbase.29). I imagine that the required indicator would be something like "Activities due". This indicator would receive the starttime and endtime from the time splitting method and would pass it to core_calendar_external::get_calendar_action_events_by_timesort (MDL-60340 needs to be implemented before this issue)

      The target is where the logic that is specific to this particular model should be implemented.

      This will be the first model to target students directly. We have different options here:

      1. To generate a notification which URL forwards the user to a view where the upcoming activities are listed (e.g. The dashboard) The URL should not be a direct url to /my, but a link to report/insights/action.php which receives a $forwardurl param. This action.php script records the fact that users clicked on the notification before forwarding them to /my. This will be useful in future for reporting purposes.
      2. To generate the standard notification which URL forwards to the insights page. Apart from the two default actions ("Acknowledged" and "Not useful") we should include a "View" action that forwards the user to the page where the upcoming activities are listed.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                8 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 - 1 week, 4 days, 2 hours, 45 minutes
                  1w 4d 2h 45m