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

Gradebook items with overridden grades causes error as Web Services response

    XMLWordPrintable

    Details

      Description

      Possibly involving core_grades_get_grades.

      Reproduction steps
      Enable Web Services in Advanced features
      Enable Web services for mobile devices in Plugins / WebServices / Services
      Use this client: https://gist.github.com/jleyva/3ccf5a8540b0e2609d29
      The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php
      You need a token related to a service, for get a token you need to create a new service, add a shortname to that service, and add the core_grade_get_grades function to that service
      Create Token:
      Click on Site administration ► Plugins ► Web services ► Manage tokens
      Click add, select user and service (You should get two tokens, one for student and one for teacher account)

      1. Create a new course, enrol the student and user used before
      2. As teacher, create a new assign (require a only text submission) as a the same student you used for getting the token, submit a text.
      3. Grade the submission as the teacher, now open the course gradebook -> Grader report. Turn editing on and edit the grade (click in the settings icon just above the grade value for the student/activity) Check the Overriden field, change the final grade
      4. Edit the client.php for adding your custom tokens and Moodle URL, also the parameters required (courseid, userids with the student user id, and cmid for the assign module)
      5. Open the script in a browser
      6. The script returns an error similar to this

        {"exception":"invalid_response_exception","errorcode":"invalidresponse","message":"Invalid response value detected","debuginfo":"items => Invalid response value detected: grades => Invalid response value detected: overridden => Invalid response value detected: Invalid external api response: the value is \"1406708203\", the server was expecting \"bool\" type"}PHP Notice:  Undefined property: stdClass::$items in /home/moodle/moodles/integration_27/moodle/client_grades.php on line 50
        PHP Notice:  Trying to get property of non-object in /home/moodle/moodles/integration_27/moodle/client_grades.php on line 50
        PHP Notice:  Trying to get property of non-object in /home/moodle/moodles/integration_27/moodle/client_grades.php on line 50
        Current grade is:
        

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              johno John Okely
              Peer reviewer:
              Adrian Greeve
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Aparup Banerjee
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14