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

WebService gradereport_user_get_grade_items should indicate if grade was overridden, locked, etc.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.2
    • Fix Version/s: 3.6
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, create a course including at least one gradable activity (quiz or assignment)
      2. Enrol one user as student in the course
      3. Enrol one user as teacher in the course
      4. Go to the course Gradebook using the left flat menu "Grades" option
      5. Turn editing on (via the top right cog)
      6. Add manually a grade for the user in the activity, for example, 66
      7. Save changes
      8. Go back to the gradebook, turn editing on and then click on the "cog" that is located on top of the "66" grade
      9. Tick the "Locked" field and save changes
      10. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      11. Create a Token in the mobile app service for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      12. Open the console an execute this new curl request, replacing wstoken with the token you just created for the user and the site url with yours. Replace the userid with the student userid

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

      13. Now check that the locked, gradeislocked and gradeisoverridden field are set to NULL
      14. Generate now a WS token for the teacher user
      15. Execute the same CURL request but replacing only the wstoken
      16. Check now that locked is set to false, gradeislocked to true and gradeisoverridden to true
      Show
      As admin, create a course including at least one gradable activity (quiz or assignment) Enrol one user as student in the course Enrol one user as teacher in the course Go to the course Gradebook using the left flat menu "Grades" option Turn editing on (via the top right cog) Add manually a grade for the user in the activity, for example, 66 Save changes Go back to the gradebook, turn editing on and then click on the "cog" that is located on top of the "66" grade Tick the "Locked" field and save changes Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student user Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created for the user and the site url with yours. Replace the userid with the student userid curl 'http://localhost/m/stable_master/webservicecurl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=gradereport_user_get_grade_items&wstoken=c0a8feaa30f5d822da28c006750771e0&courseid=3&userid=19' --compressed | python -m "json.tool" Now check that the locked, gradeislocked and gradeisoverridden field are set to NULL Generate now a WS token for the teacher user Execute the same CURL request but replacing only the wstoken Check now that locked is set to false, gradeislocked to true and gradeisoverridden to true
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63396-master

      Description

      The WebService core_grades_get_grades returns some data about each item like "locked" and "overridden". However, this WebService was deprecated and it says that now we should use gradereport_user_get_grade_items, but the latter doesn't seem to return the overridden and locked fields.

      These 2 fields are required by the Mobile app to tell if an assigment grade is locked or not (grading_disabled),

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 40 minutes
                  40m