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

New Web Service mod_scorm_get_scorm_attempt_count

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9
    • Fix Version/s: 3.0
    • Component/s: SCORM, Web Services
    • Labels:
    • Testing Instructions:
      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)
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-51017-master

      Description

      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..)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Dani Palou
              Integrator:
              Andrew Nicols
              Tester:
              John Okely
              Participants:
              Component watchers:
              Damyon Wiese, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                16/Nov/15