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

New Web Service mod_scorm_get_scorm_attempt_count

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.0
    • 2.9
    • SCORM, Web Services
    • MOODLE_29_STABLE
    • MOODLE_30_STABLE
    • MDL-51017-master
    • Hide

      Note: Version numbers are bumped because a new web service is added into the Mobile app service and also in a module.

      1. Create a course with a teacher and a student.
      2. Create a sample scorm activity, you should use the singlescobasic.zip found here https://github.com/moodle/moodle/tree/master/mod/scorm/tests/packages.
      3. As the student, access the scorm package and start a couple of attempts (don't forget to select the start new attempt option).
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the teacher and the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user .
        • You need to replace the wstoken, scormid (scorm instance id), userid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'scormid=2&userid=106&wsfunction=mod_scorm_get_scorm_attempt_count&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&ignoremissingcompletion=0'

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

      7. Confirm that
        • You receive as response an array containing empty warnings an the correct number of attempts
        • If using the student token you try to retrieve other student attempts you got a required_capability_exception
      8. * If you change ignoremissingcompletion to 1 you will receive only the count of attempts completed
        • With the teacher token you can see all the course students attempt count
        • If you try to retrieve attempts for a nonexistent scorm or user you get invalidrecord and invaliduser errors
          NOTE: In the Moodle web interface you can see the attempts report in /mod/scorm/report.php?id=X (the id is the course module id)
      Show
      Note: Version numbers are bumped because a new web service is added into the Mobile app service and also in a module. Create a course with a teacher and a student. Create a sample scorm activity, you should use the singlescobasic.zip found here https://github.com/moodle/moodle/tree/master/mod/scorm/tests/packages . As the student, access the scorm package and start a couple of attempts (don't forget to select the start new attempt option). Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the teacher and the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user . You need to replace the wstoken, scormid (scorm instance id), userid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'scormid=2&userid=106&wsfunction=mod_scorm_get_scorm_attempt_count&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e&ignoremissingcompletion=0' Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output Confirm that You receive as response an array containing empty warnings an the correct number of attempts If using the student token you try to retrieve other student attempts you got a required_capability_exception * If you change ignoremissingcompletion to 1 you will receive only the count of attempts completed With the teacher token you can see all the course students attempt count If you try to retrieve attempts for a nonexistent scorm or user you get invalidrecord and invaliduser errors NOTE: In the Moodle web interface you can see the attempts report in /mod/scorm/report.php?id=X (the id is the course module id)

      Parameters:

      • scormid
      • userid
      • ignoremissingcompletion (ignores attempts that haven't reported a grade/completion)

      Returns: The number of attempts done by a user in the given SCORM, optionally it can ignore the attempts not completed
      This will be used to know the current attempt status for the user (last attempt, etc..)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Andrew Lyons Andrew Lyons
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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