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

New Web Service mod_quiz_get_attempt_summary

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1
    • 3.0.2
    • Quiz
    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • MDL-52830-master
    • Hide
      1. Bump your /version.php file to force Moodle to reload the Mobile service
      2. Create a course with a one student
      3. Create a mod_quiz activity with a couple of questions (true or false, or numerical)
      4. Now, as the student, open the quiz and start and attempt (please, do not answer any question)
      5. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      6. Create a Token for the student
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Now, replace the wstoken and attemptid (and your site URL) and execute the following curl command

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'attemptid=11&wsfunction=mod_quiz_get_attempt_summary&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      8. Confirm that as a response you see a JSON object containing an array of questions (2 questions, the same you created), the slot and question numbers are correct (should be sequencial) and the state for both is todo, status "Not yet answered" and flagged = 0 (mark should be empty)
      9. Now, go to Moodle and as the student add a response for one of the questions
      10. Execute the same curl command and check that now you see the question with state complete and status Answer saved, if you "flag" one of the questions you will see that the flagged field for that value is equal to 1
      Show
      Bump your /version.php file to force Moodle to reload the Mobile service Create a course with a one student Create a mod_quiz activity with a couple of questions (true or false, or numerical) Now, as the student, open the quiz and start and attempt (please, do not answer any question) As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student Click on Site administration ► Plugins ► Web services ► Manage tokens Now, replace the wstoken and attemptid (and your site URL) and execute the following curl command curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'attemptid=11&wsfunction=mod_quiz_get_attempt_summary&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that as a response you see a JSON object containing an array of questions (2 questions, the same you created), the slot and question numbers are correct (should be sequencial) and the state for both is todo, status "Not yet answered" and flagged = 0 (mark should be empty) Now, go to Moodle and as the student add a response for one of the questions Execute the same curl command and check that now you see the question with state complete and status Answer saved, if you "flag" one of the questions you will see that the flagged field for that value is equal to 1

      Returns a summary of a quiz attempt before it is submitted.

      parameters
      attemptid : The attempt id
      preflightdata: Like the quiz password

      returns:
      list of questions with:
      question number (the sequencial number)
      state (integer, the state id)
      status (string associated with the state)
      flagged (whether the question is flagged or not)
      mark (optional, this depends on the quiz mode-behaviour)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Tim Hunt Tim Hunt
            Dan Poltawski Dan Poltawski
            Adrian Greeve Adrian Greeve
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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