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

Activities are triggering too many events

XMLWordPrintable

    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-66597-401
    • MDL-66597-master
    • Hide

      After pull the branch access to <wwwroot>/admin and save the default values

      Test 1 (As admin)
      1- Create a course (Course 1)
      2- In the edit settings be sure "Enable completion tracking" is checked
      3- Add a new Assignment activity (Assignment 1)
      4- In the settings of "Activity completion" of the assignment, enable "Expect completed on" and choose a date, for example tomorrow. 
      5- Hide the activity
      6- Go to Site administration / Reports / Logs
      8- Check there is only one event created with this data: 
          - "Event name": "Calendar event created"
          - "Description" The user with id '2' created the event 'Assignment 1 should be completed' with id 'X'.
      9- Check there is also a calendar event updated (From the hidden action) 
          - "Event name": Calendar event updated
          - "Description" updated the event 'Assignment 1 should be completed' with id 'X'.

      10- Execute the script attached

        php MDL-66597-queue-event-calendar.php --courseid='0'  

          This will create a new adhock_task with courseid (This means all the courses will be updated.)

      11- Execute the adhock taks: 

      php admin/cli/adhoc_task.php  --execute --force      

      12- Go to Site administration / Reports / Logs
      13- Check there aren't new completion update logs with this data
          "Event name": Calendar event updated
          "Description" updated the event 'Assignment 1 should be completed' with id 'X'.

      Test 2 (As admin)
      1- Create a course (Course 2)
      2- In the edit settings be sure "Enable completion tracking" is checked
      3- Add a new Assignment activity (Assignment 2)
      4- In the settings of "Activity completion" of the assignment, enable "Expect completed on" and choose a date from more than one year ago. 
      6- Go to Site administration / Reports / Logs
      8- Check there is only one event created with this data: 
          - "Event name": "Calendar event created"
          - "Description" The user with id '2' created the event 'Assignment 2 should be completed' with id 'X'.

      10- Execute the script attached

          php MDL-66597-queue-event-calendar.php --courseid='0'  

          This will create a new adhock_task with courseid (This means all the courses will be updated.)
      11- Execute the adhock taks: 

           php admin/cli/adhoc_task.php  --execute --force  

      12- Go to Site administration / Reports / Logs
      13- Check there aren't new completion update logs with this data
          "Event name": Calendar event updated
          "Description" updated the event 'Assignment 2 should be completed' with id 'X'.

      Show
      After pull the branch access to <wwwroot>/admin and save the default values Test 1 (As admin) 1- Create a course (Course 1) 2- In the edit settings be sure "Enable completion tracking" is checked 3- Add a new Assignment activity (Assignment 1) 4- In the settings of "Activity completion" of the assignment, enable "Expect completed on" and choose a date, for example tomorrow.  5- Hide the activity 6- Go to Site administration / Reports / Logs 8- Check there is only one event created with this data:      - "Event name": "Calendar event created"     - "Description" The user with id '2' created the event 'Assignment 1 should be completed' with id 'X'. 9- Check there is also a calendar event updated (From the hidden action)      - "Event name": Calendar event updated     - "Description" updated the event 'Assignment 1 should be completed' with id 'X'. 10- Execute the script attached   php MDL- 66597 -queue-event-calendar.php --courseid= '0'       This will create a new adhock_task with courseid (This means all the courses will be updated.) 11- Execute the adhock taks:  php admin/cli/adhoc_task.php  --execute --force      12- Go to Site administration / Reports / Logs 13- Check there aren't new completion update logs with this data     "Event name": Calendar event updated     "Description" updated the event 'Assignment 1 should be completed' with id 'X'. Test 2 (As admin) 1- Create a course (Course 2) 2- In the edit settings be sure "Enable completion tracking" is checked 3- Add a new Assignment activity (Assignment 2) 4- In the settings of "Activity completion" of the assignment, enable "Expect completed on" and choose a date from more than one year ago.  6- Go to Site administration / Reports / Logs 8- Check there is only one event created with this data:      - "Event name": "Calendar event created"     - "Description" The user with id '2' created the event 'Assignment 2 should be completed' with id 'X'. 10- Execute the script attached     php MDL- 66597 -queue-event-calendar.php --courseid= '0'       This will create a new adhock_task with courseid (This means all the courses will be updated.) 11- Execute the adhock taks:       php admin/cli/adhoc_task.php  --execute --force  12- Go to Site administration / Reports / Logs 13- Check there aren't new completion update logs with this data     "Event name": Calendar event updated     "Description" updated the event 'Assignment 2 should be completed' with id 'X'.
    • 10
    • Team Hedgehog Sprint 1.1, Team Hedgehog Sprint 1.2, Team Hedgehog Sprint 1.3, Team Hedgehog Sprint 1 review

      As reported by leelumultipass1 on MDL-56223, it seems assignment module is logging a lot of events even from inactive assigments:


      Since we upgraded from 3.1.5, a number of courses now have a daily log update:

      • User full name: 'admin user',
      • event context: 'Course: bla',
      • Component: 'System',
      • Even name: 'Calendar event updated',
      • Description: 'The user with id 'bla' updated the event 'bla' with id 'bla',
      • Origin: cli.

       

      This is happening on anything with either a due date, or an activity completion with 'expect completion on' date set, even though the due dates have long since passed (some from 2015!).

      The Calendar Events in the calendar also don't have a duration set. They're all 'Without duration'. Not sure if this has anything to do with the events being updated every day. I might have to change one and see.

       

      A fix for this would really be appreciated! Especially since we are now edging past 90% disc space usage on our backup drive!


      I did a bit of investigation and it smells in assign_refresh_events(), that's a callback function so moodle can call each module to refresh it's respective events to show in My overview block.

      But aparently it gets ALL assignments from a given course id no matter if it's inactive, hidden.. and pretty sure there's more.

      For reference: 
      We call activities refresh functions in course/lib.php more precisely here.

      I don't know for sure if that's expected (refresh events from ALL assignments), but for sure needs to be investigated further.

      Since other activities also implement same callback, pretty sure we will need to check each activity individually.

      The problems is more evident on the assignment module, because of course is one of the most used activities, but this seems to be a general problem.

        1. MDL-66597-queue-event-calendar.php
          0.7 kB
          Raquel Ortega
        2. result.png
          237 kB
          Huong Nguyen

            raquel.ortega@moodle.com Raquel Ortega
            lameze Simey Lameze
            Huong Nguyen Huong Nguyen
            Votes:
            20 Vote for this issue
            Watchers:
            31 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 4 days, 2 hours, 31 minutes
                1w 4d 2h 31m

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