LTI : synchronization grades la tâche de synchronisation des notes échoue

LTI : synchronization grades la tâche de synchronisation des notes échoue

by Sabrina Da França -
Number of replies: 3

Hello

I have searched in vain for several days now, please help me 😭!


Moodle 3.10 and 3.11

I use LTI links to give acces to my course (course1) from my moodle1 to my moodle2.

The LTI authentification and enrolment are activated on moodle1, as welle as "Allow frame embedding". I add the LTI enrolment on course1, the "Grade synchronisation" parameter is "Yes".


I took note of the launch URL and secret of this new enrolment method.

On moodle2, course2, I add an external tool activity, put the launch URL and secret I took note of, and add a Consumer key "moodle2". I enrolled a test user in course2.

I opened moodle2 in another browser (as to not have any authentification conflicts). I sign in with test user username. Everything seems fine : test user have access to course1 via course2 external tool, I do the quiz, the grade is in the grade notebook on course, moodle1.

But the grade never goes to moodle2. The task for grade synchronization for LTI provider send me a "Failed" statut no matters how many time it is launched :

Starting - Grade sync for shared tool '1' for the course '34'.
Failed - The grade '1' for the user '1483' in the tool '9462' for the course '34' failed to send.
Completed - Synced grades for tool '1' in the course '34'. Processed 1 users; sent 0 grades.

I try :
  • to set differently the enrolment method parameters on moodle1,
  • to use "Preconfigured tool" in moodle2
  • to use the LTI launch URL on other moodle than moodle2,
  • to add LTI enrolment methods on other course than course1,
  • to upgrade both moodle from 3.10 to 3.11 version...
Nothing fix the problem

Sometimes, the task is sending me a "Not send" report :
Not sent - The grade for the user '1487' in the tool '1' for the course '34' was not sent as the grades are the same.
Even thought moodle2 doesn't have any grade in rgade notebook...


Is someone know how to fix this bug ?
Thank you !

P.S : sorry for my english, I'm not native speacker

Average of ratings: -
In reply to Sabrina Da França

Re: LTI : synchronization grades la tâche de synchronisation des notes échoue

by Jake Dallimore -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Sabrina,

Just to confirm, in course 2 -> external tool instance settings, have you ticked the 'Accept grades from the tool'? This needs to be checked for grades to be accepted. I'm assuming this is checked though.

Can you tell me the exact version of 3.11 you've tried? This will help me test locally.

That last trace (e.g. ...was not sent as the grades are the same.) is what you'll see if the grade has been sent successfully once and is then sent again with the same value. The tool only updates the lastgrade value which it uses for this comparison if the grade was sent successfully once before. This suggests the grade was successfully sent at some point. If you change the grade and run cron again, you should see that the updated grade will be sent.

Also, please note that MDL-69542 is not a bug and is not related to what you're discussing here. That tracker issue deals with adding support for 1.3 to the tool provider code.

Cheers,
Jake
In reply to Jake Dallimore

Re: LTI : synchronization grades la tâche de synchronisation des notes échoue

by Sabrina Da França -
Hi Jake,
Thanks for you answer

Yes I have activated 'Accept grades from the tool'

I have tried with several moodle :
- The provider in 3.11.5, and the client in 3.11.4+
- the provider in 3.11.4+ and the client in 3.11.3+
- the provider in 3.114+ and the client in 3.10.3
- the provider in 3.114+ and the client in 3.10.1
- the provider in 3.10.1 and the client in 3.114+
Always the same result.

I agree with you, but the fact is I don't have any grade in the client gradebook (even several days later, after having purged caches and manualy run cron), nor did I ever see a "succes" message in this task.
In reply to Sabrina Da França

Re: LTI : synchronization grades la tâche de synchronisation des notes échoue

by Jake Dallimore -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Sabrina,

Looking at the task code, it seems that "Failed to send" (without any exception data, as it seems is the case in your log above) is reported when the score post receives a response containing a message other than 'success'. Unfortunately, the task doesn't report the response, which may hint at why the grade couldn't be sent.

Unfortunately, I'm unable to replicate your issue here using Moodle 3.11, so any troubleshooting will need to be on your end.  I'd recommend adding this debugging call to the task and trying again (make sure you change the grade first, of course, so you don't hit the "Grade is the same" check).

Please add the following:

mtrace($response);
Right below this line (https://github.com/moodle/moodle/blob/158898254cd2bf20c8126c22960a33d460e4def5/enrol/lti/classes/task/sync_grades.php#L181)
In the enrol/lti/task/sync_grades.php file on your moodle1 site. This will report the response alongside the "Failed to send" message (which by itself is not very useful).

Then, rerun the task after you've changed the grade and share the response here.

Cheers,
Jake