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

gradereport_user_get_grade_items fails when "Course Grade Settings" when "Show Feedback" is set to "False" for user reports

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.4, 3.4.5, 3.4.6, 3.5.1, 3.5.2, 3.5.3, 3.6.4, 3.7.1, 3.8
    • Fix Version/s: 3.6.7, 3.7.3
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Use an existing course with several activities configured (that return grades, like quiz, assignment or forum) in the course
      2. Enrol or use one of the student users of the course
      3. As teacher, go to configure the course Gradebook via the course configuration cog -> Gradebook setup
      4. Then go to "Course grade settings" tab and set the "Show feedback" option to "Hide" (save changes)
      5. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      6. Create a Token for the studentuser
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken with the student one, userid with the student one, courseid with the course one and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=4&userid=19&wsfunction=gradereport_user_get_grade_items&wstoken=3af67232a7596ceb658df4db329e5ad6' | python -m "json.tool"

      8. Check that you:
        • Receive all the grade items visible by the user
        • There isn't "feedback" or "feedbackformat" information in the received info.
      Show
      Use an existing course with several activities configured (that return grades, like quiz, assignment or forum) in the course Enrol or use one of the student users of the course As teacher, go to configure the course Gradebook via the course configuration cog -> Gradebook setup Then go to "Course grade settings" tab and set the "Show feedback" option to "Hide" (save changes) As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the studentuser Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken with the student one, userid with the student one, courseid with the course one and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=4&userid=19&wsfunction=gradereport_user_get_grade_items&wstoken=3af67232a7596ceb658df4db329e5ad6' | python -m "json.tool" Check that you: Receive all the grade items visible by the user There isn't "feedback" or "feedbackformat" information in the received info.
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.6 Branch:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-64298-master

      Description

      The gradereport_user_get_grade_items function does not always work, depending on how the grade book has been configured. I've not been able to isolate the reason why it works in one course but not in another.

      Invoking the command:

      http://192.168.1.200:8000/moodle_35/webservice/rest/server.php?wstoken=test&wsfunction=gradereport_user_get_grade_items&moodlewsrestformat=json&courseid=20

      Sometimes returns:

      {{{}}
      "exception":"invalid_response_exception", "errorcode":"invalidresponse",
      "message":"Invalid response value detected",
      "debuginfo":"usergrades => Invalid response value detected: gradeitems => Invalid response value detected: Error in response - Missing following required key in a single structure: feedbackformat" } 

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 15 minutes
                  2h 15m