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

Unchanged grades repeatedly sent in LTI grade sync

XMLWordPrintable

    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-61324_lti_sync
    • Hide
      1. Set up two moodle systems, one as an LTI provider and one as a consumer. On the provider site set up a quiz with a single multiple choice question with one answer having the grade 100%, and one answer having the grade 33.3%. Share the quiz with the consumer system using Published as LTI Tools, and adding as an External Tool on the consumer system.
      2. Log into the consumer system as a student user, complete the quiz you just created answering with the option you gave the grade of 33.3%. 
      3. From the moodle root of the provider system, run the command `php admin/tool/task/cli/schedule_task.php --execute=\enrol_lti\task\sync_grades`
      4. Look at the web server logs for the consumer system. You should see an entry something like `xx.xxx.xxx.xxx -  [31/Jan/2018:11:17:12 +0000] "POST /mod/lti/service.php HTTP/1.1" 200 554 "" "MoodleBot/1.0"`
      5. Re run the sync grades task on the provider system, and again check the web server logs. If fix has worked, you will not see another log entry for MoodleBot. If fix has failed, you will continue to see entries for MoodleBot each time the task is run. 
      Show
      Set up two moodle systems, one as an LTI provider and one as a consumer. On the provider site set up a quiz with a single multiple choice question with one answer having the grade 100%, and one answer having the grade 33.3%. Share the quiz with the consumer system using Published as LTI Tools, and adding as an External Tool on the consumer system. Log into the consumer system as a student user, complete the quiz you just created answering with the option you gave the grade of 33.3%.  From the moodle root of the provider system, run the command `php admin/tool/task/cli/schedule_task.php --execute=\enrol_lti\task\sync_grades` Look at the web server logs for the consumer system. You should see an entry something like `xx.xxx.xxx.xxx -   [31/Jan/2018:11:17:12 +0000]  "POST /mod/lti/service.php HTTP/1.1" 200 554 "" "MoodleBot/1.0"` Re run the sync grades task on the provider system, and again check the web server logs. If fix has worked, you will not see another log entry for MoodleBot. If fix has failed, you will continue to see entries for MoodleBot each time the task is run. 

      When invoking moodle lti grade sync, unchanged grades are repeatedly sent on subsequent syncs to the consumer system regardless of whether they have changed, if the `grade` variable is a float. 

      The sync grades function checks whether the grade has changed by comparing the current `grade` with the `lastgrade` field in the `enrol_lti_users` database table. If it has changed, it will send the grade to the consumer system.

      However the comparison will fail when `grade` is a float, because `lastgrade` is cast to an int when saved to the `enrol_lti_users` database table [on line 177](https://github.com/moodle/moodle/blob/8ed2bbcfed79b8224876364ca428049563128145/enrol/lti/classes/task/sync_grades.php#L177).

       

      Steps to reproduce:

      1. Set up two moodle systems, one as an LTI provider and one as a consumer. On the provider site set up a quiz with a single multiple choice question with one answer having the grade 100%, and one answer having the grade 33.3%. Share the quiz with the consumer system using Published as LTI Tools, and adding as an External Tool on the consumer system.
      2. Log into the consumer system as a student user, complete the quiz you just created answering with the option you gave the grade of 33.3%. 
      3. From the moodle root of the provider system, run the command `php admin/tool/task/cli/schedule_task.php --execute=\enrol_lti\task\sync_grades`
      4. Look at the web server logs for the consumer system. You should see an entry something like `xx.xxx.xxx.xxx - - [31/Jan/2018:11:17:12 +0000] "POST /mod/lti/service.php HTTP/1.1" 200 554 "-" "MoodleBot/1.0"`
      5. Re run the sync grades task on the provider system, and again check the web server logs. You will see each time you run sync grades, it will re-send the grade.

      I have also inspected the LTI xml data that is sent in the above example and confirmed that it is sending the exact same grade each time. 

            davosmith Davo Smith
            josh-newton josh-newton
            Mark Nelson Mark Nelson
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Marina Glancy Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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