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

Broken grade Web Service gradereport_user_get_grade_items

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 4.0
    • 4.0
    • Assignment
    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-73572-master
    • Hide
      Test
      1. As an admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a new course
      3. Create a new assignment activity, setting the following:
        • Submission types: Only "Online text" selected
        • Grade -> Grade to pass: Set to 50
      4. Enrol one user as student in the course
      5. Create a Token in the mobile app service for the previous user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Now, login in the site as the student user
      7. Go to the assignment activity created in step 3 and make a submission (ensure you do a full submission, that is not kept a draft state)
      8. Login as admin again
      9. Go to the course and grade the student user submission with a 80
      10. Login again as student and go to the course grade book (Grades option), confirm that
        • You see that you were graded with an 80, at the left of the number you see a tick ✔️
      11. Open the console and execute this new curl request, replacing wstoken with the token you created for the user, the SITE_URL with yours, USERID with the student user id and COURSEID with the course id where the assignment is

        curl 'SITE_URL/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=gradereport_user_get_grade_items' --data 'courseid=COURSEID&userid=USERID&moodlewssettingfilter=true&moodlewssettingfileurl=true&moodlewssettinglang=en&wstoken=WSTOKEN' --compressed | python -m "json.tool"

      12. Confirm that:
        • In the curl request response you see a gradeformatted field containing html tags that indicates the 80 passing grade
      Show
      Test As an admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a new course Create a new assignment activity, setting the following: Submission types: Only "Online text" selected Grade -> Grade to pass: Set to 50 Enrol one user as student in the course Create a Token in the mobile app service for the previous user Click on Site administration ► Plugins ► Web services ► Manage tokens Now, login in the site as the student user Go to the assignment activity created in step 3 and make a submission (ensure you do a full submission, that is not kept a draft state) Login as admin again Go to the course and grade the student user submission with a 80 Login again as student and go to the course grade book (Grades option), confirm that You see that you were graded with an 80, at the left of the number you see a tick ✔️ Open the console and execute this new curl request, replacing wstoken with the token you created for the user, the SITE_URL with yours, USERID with the student user id and COURSEID with the course id where the assignment is curl 'SITE_URL/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=gradereport_user_get_grade_items' --data 'courseid=COURSEID&userid=USERID&moodlewssettingfilter=true&moodlewssettingfileurl=true&moodlewssettinglang=en&wstoken=WSTOKEN' --compressed | python -m "json.tool" Confirm that: In the curl request response you see a gradeformatted field containing html tags that indicates the 80 passing grade

    Description

      MDL-70874 introduced some changes to include HTML tags in the grade content, this is breaking some WebServices that were not expecting to return HTML in the grade content field.

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Pau Ferrer Pau Ferrer
              Victor Déniz Falcón Victor Déniz Falcón
              Angelia Dela Cruz Angelia Dela Cruz
              Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                19/Apr/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 10 minutes
                  1h 10m