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

New Web Service mod_quiz_get_user_best_grade

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1
    • 3.0.2
    • Quiz, Web Services
    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • MDL-52785-master
    • Hide
      1. Bump your /version.php file to force Moodle to reload the Mobile service
      2. Create a course with a student.
      3. Create a mod_quiz activity with at least one question (self-evaluable)
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, quizid (the quiz instance value) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'quizid=2&wsfunction=mod_quiz_get_user_best_grade&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed

      7. Confirm that
        • You see that the response is a JSON string containing hasgrade equal to false, you don't see any grade returned
      8. Now as student in the Moodle web interface do the quiz and obtain a grade
      9. Run the WS again, check that now hasgrade is equal to true and that you see the grade you obtained (pllease, note that the grade may be scaled)
      10. Now, obtain a token for a teacher user in the same course
      11. Run the curl command adding a new parameter &userid=THE_STUDENT_ID, check that you can see the student grade
      12. Obtain a token for a user in a different course, check that running the curl command return require_login_exception
      Show
      Bump your /version.php file to force Moodle to reload the Mobile service Create a course with a student. Create a mod_quiz activity with at least one question (self-evaluable) As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, quizid (the quiz instance value) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'quizid=2&wsfunction=mod_quiz_get_user_best_grade&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed Confirm that You see that the response is a JSON string containing hasgrade equal to false, you don't see any grade returned Now as student in the Moodle web interface do the quiz and obtain a grade Run the WS again, check that now hasgrade is equal to true and that you see the grade you obtained (pllease, note that the grade may be scaled) Now, obtain a token for a teacher user in the same course Run the curl command adding a new parameter &userid=THE_STUDENT_ID, check that you can see the student grade Obtain a token for a user in a different course, check that running the curl command return require_login_exception

      Get the best current grade for the given user in a quiz.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Tim Hunt Tim Hunt
            David Monllaó David Monllaó
            cameron1729 cameron1729
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.