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

New Web Service mod_lesson_launch_attempt

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. In a course create a lesson with at least one content page and one question page.
      2. Enrol one user as student in the course where the lesson is.
      3. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, lessonid (the lesson instance value) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=8&wsfunction=mod_lesson_launch_attempt&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      6. Confirm you don't receive any exception
      7. Confirm that in the moodle database, in the lesson_timer table there is a new entry for the lesson with the starttime set to the current time
      8. Now, execute the same curl request but passing as parameter &pageid=X where X is the id of one of the lesson pages (check the lesson_pages table in db to get one)
      9. Confirm that in the lesson_timer table you don't see new entries but you see the existing entry for the lesson with the lessontime set to the current timestamp
      10. Finally, as admin, edit the lesson and as a password as restriction
      11. Execute again the WS passing the password as parameter (&password=X) and check that the lessontime is successfully updated
      Show
      In a course create a lesson with at least one content page and one question page. Enrol one user as student in the course where the lesson is. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings 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, lessonid (the lesson instance value) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=8&wsfunction=mod_lesson_launch_attempt&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Confirm you don't receive any exception Confirm that in the moodle database, in the lesson_timer table there is a new entry for the lesson with the starttime set to the current time Now, execute the same curl request but passing as parameter &pageid=X where X is the id of one of the lesson pages (check the lesson_pages table in db to get one) Confirm that in the lesson_timer table you don't see new entries but you see the existing entry for the lesson with the lessontime set to the current timestamp Finally, as admin, edit the lesson and as a password as restriction Execute again the WS passing the password as parameter (&password=X) and check that the lessontime is successfully updated
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57688-master

      Description

      Starts or continues an existing lesson attempt (it basically set the user timers to correct values)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Dani Palou
              Integrator:
              David Monllaó
              Tester:
              Ryan Wyllie
              Participants:
              Component watchers:
              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:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17