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

Assignment notifications with marking workflow get stuck in cron

XMLWordPrintable

    • MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_36_STABLE, MOODLE_37_STABLE
    • MDL-66915-master
    • Hide

      Prerequisites:

      1. Please run mailcatcher, and load up the view in a new tab: localhost:1080
      2. Set up smtp for your site, setting it to 'localhost:1025'

      Setup

      1. Create a new course.
      2. Enrol a teacher and a student
      3. Add an assignment called A1 (enable "Use marking workflow").
      4. Add an assignment called A2 (DO NOT enable "Use marking workflow").
      5. As the student, add a submission to both assignments.

      Testing changes made outside of 24h window.

      1. Login as the teacher
      2. Grade the submission to A1 (set a grade and comments and set the workflow state to 'released'). Save changes (enable "Notify students" checkbox).
      3. Grade the submission to A2 (set a grade and comments). Save changes (enable "Notify students" checkbox).
      4. Now, set your system clock forward by at least 24 hours (just add a couple of days). This process will vary per distro flavour, but should be fairly trivial to do.
      5. Run:

        php admin/cli/cron.php > /tmp/cronoutput.txt

      6. Open the /tmp/cronoutput.txt file
      7. Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do.
      8. Search for 'Processing assignment' within the file.
      9. Verify you don't find it in the file.
      10. Verify you don't see any email in mailcatcher relating to the teacher grading the assignment.

      Testing changes made within the 24h window

      1. Now, as the teacher, change the grade for the same student on the grader interface for A1, and save.
      2. Do the same for the student in A2 and save.
      3. Run:

        php admin/cli/cron.php > /tmp/cronoutput.txt

      4. Open the /tmp/cronoutput.txt file
      5. Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do.
      6. Search for 'Processing assignment' within the file.
      7. Verify you see a line in the output
      8. Verify you see 2 emails in mailcatcher telling the student that their assignment has received feedback (one for A1 and one for A2).

      Testing the unenrolled student case within the 24h window

      1. Again, as the teacher, change the grade for the student in A1 and click save.
      2. Do the same for the student in A2.
      3. Now, unenrol the student from the course
      4. Run:

        php admin/cli/cron.php > /tmp/cronoutput.txt

      5. Open the /tmp/cronoutput.txt file
      6. Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do.
      7. Search for 'Processing assignment' within the file.
      8. Verify you see a line and that below that you see a lines reading "xxx not an active participant in yyy" where xxx is the student name and yyy is the course name
      9. Verify that you see this output twice in the file (one for each assignment)
      10. Verify you don't see any new emails in mailcatcher

      Testing the unenrolled student case outside of the 24h window

      1. Now, again set your system clock forward a few more days
      2. Run:

        php admin/cli/cron.php > /tmp/cronoutput.txt

      3. Open the /tmp/cronoutput.txt file
      4. Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do.
      5. Search for 'Processing assignment' within the file.
      6. Verify you don't find it in the file.
      7. Verify you don't see any new emails in mailcatcher
      Show
      Prerequisites: Please run mailcatcher, and load up the view in a new tab: localhost:1080 Set up smtp for your site, setting it to 'localhost:1025' Setup Create a new course. Enrol a teacher and a student Add an assignment called A1 (enable "Use marking workflow"). Add an assignment called A2 (DO NOT enable "Use marking workflow"). As the student, add a submission to both assignments. Testing changes made outside of 24h window. Login as the teacher Grade the submission to A1 (set a grade and comments and set the workflow state to 'released'). Save changes (enable "Notify students" checkbox). Grade the submission to A2 (set a grade and comments). Save changes (enable "Notify students" checkbox). Now, set your system clock forward by at least 24 hours (just add a couple of days). This process will vary per distro flavour, but should be fairly trivial to do. Run: php admin/cli/cron.php > /tmp/cronoutput.txt Open the /tmp/cronoutput.txt file Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do. Search for 'Processing assignment' within the file. Verify you don't find it in the file. Verify you don't see any email in mailcatcher relating to the teacher grading the assignment. Testing changes made within the 24h window Now, as the teacher, change the grade for the same student on the grader interface for A1, and save. Do the same for the student in A2 and save. Run: php admin/cli/cron.php > /tmp/cronoutput.txt Open the /tmp/cronoutput.txt file Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do. Search for 'Processing assignment' within the file. Verify you see a line in the output Verify you see 2 emails in mailcatcher telling the student that their assignment has received feedback (one for A1 and one for A2). Testing the unenrolled student case within the 24h window Again, as the teacher, change the grade for the student in A1 and click save. Do the same for the student in A2. Now, unenrol the student from the course Run: php admin/cli/cron.php > /tmp/cronoutput.txt Open the /tmp/cronoutput.txt file Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do. Search for 'Processing assignment' within the file. Verify you see a line and that below that you see a lines reading "xxx not an active participant in yyy" where xxx is the student name and yyy is the course name Verify that you see this output twice in the file (one for each assignment) Verify you don't see any new emails in mailcatcher Testing the unenrolled student case outside of the 24h window Now, again set your system clock forward a few more days Run: php admin/cli/cron.php > /tmp/cronoutput.txt Open the /tmp/cronoutput.txt file Make sure you have more than just a few lines of output. You must see "Execute scheduled task:" lines. If you don't run the above again until you do. Search for 'Processing assignment' within the file. Verify you don't find it in the file. Verify you don't see any new emails in mailcatcher

      If you have an assignment that uses the marking workflow, it might happen that the notifications get stuck in the cron and show up on every cron run. The foreach loop in the function assign::cron() skips every user who is not enrolled in the course or if the assignment is hidden. The cron function tries to send these notifications the next time again and again.

      If marking workflow is disabled, the cron function tries to send the notifications only if the grade was updated in the past 24 hours. I think this should also be the behaviour if marking workflow is enabled.

      Original testing instructions for posterity:

      1. Create a new course.
      2. As a teacher, add an assignment activity (enable "Use marking workflow").
      3. As a student, add a submission.
      4. As teacher, grade the submission and set the workflow state to released. Save changes (enable "Notify students").
      5. Unenrol the student from the course.
      6. Start the Moodle cron process. (e.g. execute "php admin/cli/cron.php" in the Moodle directory). This will run all cron jobs. You have to search the log output for the assign cron job. If you have pathtophp set in your Site administration you could also run the cron job 'mod_assign\task\cron_task' ("Background processing for assignment module") directly from the UI on admin/tool/task/schedule_task.php
        1. Without the patch, every time (once per minute) you run the assign cron you see the log output (Moodle never gives up):

            Processing x assignment submissions ...
            Processing assignment submission x ...
            user x not an active participant in x
          

        2. With the patch, Moodle will only try to send the notification within 24 hours after the grade was updated (and give up afterwards).
      7. Try the cron job run 24 hours later and the message 'user x not an active participant in x' (BTW: that's not even a proper phrase) won't appear any more. To speed up this procedure, you could modify the assign_grades table and set back the timemodified value by 86400 of the row that corresponds with the grade from step 4.

            mgauk Martin Gauk
            mgauk Martin Gauk
            Luca Bösch Luca Bösch
            Jake Dallimore Jake Dallimore
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h

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