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

New web services for triggering events in mod_quiz

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.1
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      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
      4. Log in as the student and visit the quiz activity, start a new attempt
      5. Then go to the summary view
      6. And finally, submit the attempt and review it
      7. Log in as teacher and check that the student action generated several entries in the logs (course -> reports -> logs) (quiz attempt viewed, Quiz attempt summary viewed and Quiz attempt reviewed with origin web)
      8. Now, as the student again start a new fresh attempt (do nothing else)
      9. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      10. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      11. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, attempid and the URL of your moodle instance

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

      12. Confirm that
        • You can see new entries in the course log (quiz attempt viewed) for that course and the user. The origin for the new log entries is "ws"
      13. Now, execute the same curl request but removing &page=0 and replacing, mod_quiz_view_attempt with mod_quiz_view_attempt_summary
      14. Check that there is a new entry in the course log (quiz attempt summary viewed) with origin "ws"
      15. Now, as the student, log in in Moodle and finish the attempt
      16. Execute the same curl request replacing mod_quiz_view_attempt_summary with mod_quiz_view_attempt_review
      17. Check that there is a new entry in the course log (quiz attempt reviewed) with origin "ws"
      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 Log in as the student and visit the quiz activity, start a new attempt Then go to the summary view And finally, submit the attempt and review it Log in as teacher and check that the student action generated several entries in the logs (course -> reports -> logs) (quiz attempt viewed, Quiz attempt summary viewed and Quiz attempt reviewed with origin web) Now, as the student again start a new fresh attempt (do nothing else) 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, attempid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'attemptid=2&wsfunction=mod_quiz_view_attempt&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&page=0' --compressed Confirm that You can see new entries in the course log (quiz attempt viewed) for that course and the user. The origin for the new log entries is "ws" Now, execute the same curl request but removing &page=0 and replacing, mod_quiz_view_attempt with mod_quiz_view_attempt_summary Check that there is a new entry in the course log (quiz attempt summary viewed) with origin "ws" Now, as the student, log in in Moodle and finish the attempt Execute the same curl request replacing mod_quiz_view_attempt_summary with mod_quiz_view_attempt_review Check that there is a new entry in the course log (quiz attempt reviewed) with origin "ws"
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-52888-master

      Description

      mod_quiz_view_attempt (attemptid, page)

      To trigger the attempt viewed event and to set the current page in the attempt.

      mod_quiz_view_attempt_summary (attempt)

      To trigger the attempt summary viewed event.

      mod_quiz_view_attempt_review (attempt)

      To trigger the attempt reviewed event.

      All returning a status field

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Tim Hunt
                Integrator:
                Eloy Lafuente (stronk7)
                Tester:
                Mark Nelson
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16