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

Assign feedback not sent if assign grade timemodified is set two days ago

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      • Make sure that you have ghostscript enabled for pdf annotation.
      1. Set up an assignment with File submissions.
      2. Enable 'Feedback comments' and 'Feedback files'.
      3. Log in as a student and submit a pdf with multiple pages if possible.
      4. Open up the table mdl_assign_grades.
      5. Log in as a teacher / administrator and go to the assignment grading page.
      6. Add some text feedback.
      7. Save the page and check that an entry has been created in the assign_grades table.
      8. Go back to the grading page and alter the text. Check that the time modified column changes.
      9. Go back to the grading page and just click save. Check that the time modified column does not change.
      10. Add some more text to the feedback and then delete it. Save and check the time modified has not changed.
      11. Now click on the Launch PDF editor... button and create both comments and annotations (on different pages would be good).
      12. Click save and check the time modified. It should have changed.
      13. Go back and add another annotation. Save. Check that the time is modified.
      14. Go back and add one annotation and delete another. Save. Check that the time is modified.
      15. Add and delete the same comment or annotation. Save. Check that the time is not modified.
      16. Add a feedback file and save. Check that the time is modified.
      17. Add a second file and save. Check that the time is modified.
      18. Try adding a third file, delete one of the others and rename the third file the same name as the deleted file. Save. Check that the time is modified.
      19. Add a directory. Add a file to the directory. Save. Check that the time is modified.
      20. Try swapping the file in the directory with a new one with the same name. Check that the time is modified.

      Bonus

      1. Try any other combination and check that the time modified is changed when appropriate.

      Described problem testing

      1. As a teacher create an assign
      2. As a teacher set "Default setting for Notify Students" to yes
      3. As a teacher set "Feedback types" to "Feedback comments"
      4. As a student submit to the assign
      5. As a teacher click on the grade icon (don't use the quick grading option)
      6. As a teacher do not modify the grade, just add a feedback comment
      7. As a teacher click "Save changes"
      8. As an admin run the assign cron (task) (remember to use the apache user if necessary)

        php admin/tool/task/cli/schedule_task.php --execute="\\core\\task\\legacy_plugin_cron_task"
        

      • The student receives a notification telling him/her that the teacher has written feedback.
      • Now we have to emulate waiting for two days.
      • Change the time modified field to {unix timestamp}

        - 3600*24*5

      • Now go and make an alteration to the feedback (feedback only).
      • Run the cron again as mentioned above.
      • The student should again receive a notification telling them that the teacher has written feedback.
      Show
      Make sure that you have ghostscript enabled for pdf annotation. Set up an assignment with File submissions. Enable 'Feedback comments' and 'Feedback files'. Log in as a student and submit a pdf with multiple pages if possible. Open up the table mdl_assign_grades. Log in as a teacher / administrator and go to the assignment grading page. Add some text feedback. Save the page and check that an entry has been created in the assign_grades table. Go back to the grading page and alter the text. Check that the time modified column changes. Go back to the grading page and just click save. Check that the time modified column does not change. Add some more text to the feedback and then delete it. Save and check the time modified has not changed. Now click on the Launch PDF editor... button and create both comments and annotations (on different pages would be good). Click save and check the time modified. It should have changed. Go back and add another annotation. Save. Check that the time is modified. Go back and add one annotation and delete another. Save. Check that the time is modified. Add and delete the same comment or annotation. Save. Check that the time is not modified. Add a feedback file and save. Check that the time is modified. Add a second file and save. Check that the time is modified. Try adding a third file, delete one of the others and rename the third file the same name as the deleted file. Save. Check that the time is modified. Add a directory. Add a file to the directory. Save. Check that the time is modified. Try swapping the file in the directory with a new one with the same name. Check that the time is modified. Bonus Try any other combination and check that the time modified is changed when appropriate. Described problem testing As a teacher create an assign As a teacher set "Default setting for Notify Students" to yes As a teacher set "Feedback types" to "Feedback comments" As a student submit to the assign As a teacher click on the grade icon (don't use the quick grading option) As a teacher do not modify the grade, just add a feedback comment As a teacher click "Save changes" As an admin run the assign cron (task) (remember to use the apache user if necessary) php admin/tool/task/cli/schedule_task.php --execute="\\core\\task\\legacy_plugin_cron_task" The student receives a notification telling him/her that the teacher has written feedback. Now we have to emulate waiting for two days. Change the time modified field to {unix timestamp} - 3600*24*5 Now go and make an alteration to the feedback (feedback only). Run the cron again as mentioned above. The student should again receive a notification telling them that the teacher has written feedback.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-52397-master
    • Sprint:
      3.1 Sprint 5
    • Issue size:
      Medium

      Description

      To reproduce:

      • As a teacher create an assign
      • As a teacher set "Default setting for Notify Students" to yes
      • As a teacher set "Feedback types" to "Feedback comments"
      • As a student submit to the assign
      • As a teacher click on the grade icon (don't use the quick grading option)
      • As a teacher do not modify the grade, just add a feedback comment
      • As a teacher click "Save changes"
      • As an admin run the assign cron (task) (remember to use the apache user if necessary)

        php schedule_task.php --execute="\\core\\task\\legacy_plugin_cron_task"
        

      The student receives a notification telling him/her that the teacher has written feedback. That's right.

      • Wait for two days and modify the comment from the same page (not the quickgrading one)

      The student doesn't receive the notification.

      Of course you can emulate this behaviour. Before modifying the feedback execute this query (mysql):

      SELECT max(id) from mdl_assign_grades INTO @agid;
      UPDATE mdl_assign_grades SET timemodified = (unix_timestamp()-3600*24*5) WHERE id = @agid;
      

      Now add a feedback comment from the grading page (not the quickgrading one) and the student doesn't receive the notification.

      If you add a comment from the quickgrading table, the message is sent always. I think that this is the expected behaviour.

      I think that this is happening since the following commit was introduce:

      commit 5a92a95e9c99382e0dfea92b1b03fe600aacfbab
      Author: Damyon Wiese <damyon@moodle.com>
      Date:   Fri Oct 9 15:08:06 2015 +0800
       
          MDL-48861 mod_assign: use >= for requires grading filter
          
          If the grade and submission were modified at exactly the same time,
          assume that this means the grade was automatically created for the submission
          and is not a real grade from a teacher interaction.
       
      diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php
      index effc0bf..6a9d791 100644
      --- a/mod/assign/locallib.php
      +++ b/mod/assign/locallib.php
      @@ -1518,7 +1518,7 @@ class assign {
                               s.assignment = :assignid AND
       
      diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php
      index 6a9d791..0d1c3b6 100644
      --- a/mod/assign/locallib.php
      +++ b/mod/assign/locallib.php
      @@ -6678,6 +6678,7 @@ class assign {
               global $USER, $CFG, $DB;
       
               $grade = $this->get_user_grade($userid, true, $attemptnumber);
      +        $originalgrade = $grade->grade;
               $gradingdisabled = $this->grading_disabled($userid);
               $gradinginstance = $this->get_grading_instance($userid, $grade, $gradingdisabled);
               if (!$gradingdisabled) {
      @@ -6722,7 +6723,12 @@ class assign {
                       }
                   }
               }
      -        $this->update_grade($grade, !empty($formdata->addattempt));
      +        // We do not want to update the timemodified if no grade was added.
      +        if (!empty($formdata->addattempt) ||
      +                ($originalgrade !== null && $originalgrade != -1) ||
      +                ($grade->grade !== null && $grade->grade != -1)) {
      +            $this->update_grade($grade, !empty($formdata->addattempt));
      +        }
               // Note the default if not provided for this option is true (e.g. webservices).
               // This is for backwards compatibility.
               if (!isset($formdata->sendstudentnotifications) || $formdata->sendstudentnotifications) {
      

      The timemodified in grade is not changed if no grade is given and if the timemodified doesn't changes the mail (see the cron function) is not sent after a day or so.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                16 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16