question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lti.Grade.submitScore() Error

See original GitHub issue

Describe the bug When I try to update a line item using the Grade.submitScore() function, I get an error, it appears that the score object is not being created properly or I am missing fields.

    const result  = await lti.Grade.getLineItems(res.locals.token)

    let grade = {
        'scoreGiven': 83,
        'userId': 3,
    }
    
    await lti.Grade.submitScore(res.locals.token, result.lineItems[1].id, grade)

Expected behavior Update the given line item with the provided grade.

Provider logs

  provider:main Receiving request at path: /api/grade +49ms
  provider:main Path does not match reserved endpoints +0ms
  provider:main Cookies received:  +0ms
  provider:main [Object: null prototype] {
  provider:main   'ltiaHR0cDovLzMuODQuMTQzLjU1L21vb2RsZUROeE9UTGFRQVNSanNpejI%3D': '2' } +0ms
  provider:main Ltik found +0ms
  provider:main Ltik successfully verified +1ms
  provider:main Attempting to retrieve matching session cookie +0ms
  provider:auth Valid session found +54ms
  provider:main Passing request to next handler +4ms
  provider:gradeService Target platform: http://3.84.143.55/moodle +0ms
  provider:gradeService Attempting to retrieve platform access_token for [http://3.84.143.55/moodle] +2ms
  provider:platform Access_token found +52ms
  provider:gradeService Access_token retrieved for [http://3.84.143.55/moodle] +2ms
  provider:gradeService Requesting line items from: http://3.84.143.55/moodle/mod/lti/services.php/2/lineitems +0ms
  provider:gradeService Target platform: http://3.84.143.55/moodle +18ms
  provider:gradeService Attempting to retrieve platform access_token for [http://3.84.143.55/moodle] +2ms
  provider:platform Access_token found +22ms
  provider:gradeService Access_token retrieved for [http://3.84.143.55/moodle] +1ms
  provider:gradeService Target platform: http://3.84.143.55/moodle +1ms
  provider:gradeService Retrieving: http://3.84.143.55/moodle/mod/lti/services.php/2/lineitems/10/lineitem?type_id=2 +0ms
  provider:gradeService LineItem sucessfully retrieved +16ms
  provider:gradeService Sending score to: http://3.84.143.55/moodle/mod/lti/services.php/2/lineitems/10/lineitem/scores?type_id=2 +0ms
  provider:gradeService { scoreGiven: 83,
  provider:gradeService   userId: 3,
  provider:gradeService   scoreMaximum: 100,
  provider:gradeService   timestamp: '2020-11-20T20:11:10.221Z' } +0ms
(node:25478) UnhandledPromiseRejectionWarning: HTTPError: Response code 400 (Incorrect score                                                                 received{"scoreGiven":83,"userId":3,"scoreMaximum":100,"timestamp":"2020-11-20T20:11:10.221Z"                                                                })
    at Request.request.once (/home/ubuntu/lti3/node_modules/got/dist/source/as-promise/index.                                                                js:117:42)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:25478) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error origin                                                                ated either by throwing inside of an async function without a catch block, or by rejecting a                                                                 promise which was not handled with .catch(). (rejection id: 1)
(node:25478) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In th                                                                e future, promise rejections that are not handled will terminate the Node.js process with a n                                                                on-zero exit code.

Ltijs version

  • Current

NodeJS version

  • 10.19.0

Platform used

  • Moodle

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Cvmcostacommented, Nov 20, 2020

My pleasure! I would also like to state that i am working on the complete Grades Service documentation. I know it’s long overdue but this Service is by far the biggest and i didn’t have much time lately to focus on documenting it (specially since i was focused on adding new methods to make it’s usage more straight forward and flexible).

1reaction
bennettyardleycommented, Nov 20, 2020

Thank you I was missing those fields!

Read more comments on GitHub >

github_iconTop Results From Across the Web

LTI Grading via Outcome Service Error - Canvas Community
I am trying to submit a grade using the outcomes service in LTI. I am getting an error saying that "Assignment is no...
Read more >
Learning Tools Interoperability (LTI) Assignment and Grade ...
The Assignment and Grade Services are made of 3 services: LineItem service: Management of line items; Score Service: Posting of scores by the...
Read more >
error during LTI reporting of grade back to Canvas - WeBWorK
WeBWorK correctly grades the problem because I can see the score in the WeBWorK gradebook, but is unable to report the grade back...
Read more >
Numbas LTI provider Documentation
This is a Basic LTI 1.1 tool provider, to run Numbas exams in any LTI-compatible virtual learning environment.
Read more >
MyOpenMath
Free and Open. Students. Are you a student looking to study mathematics on your own, and want to do exercises with immediate feedback...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found