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

New Web Service mod_lesson_get_pages_possible_jumps

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. In a course create a lesson with at least two content pages and one question page.
      3. In the lesson settings, enable Availability -> Allow lesson to be attempted offline using the mobile app
      4. In the first page add links to the next page and end of lesson
      5. In the second page add links to a random page, the first page and the end of lesson
      6. Enrol one user as student in the course where the lesson is.
      7. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. 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).

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

      1. Now check that calculatedjump for all the jumps is always a value > 0. There is an exception, when the jump is to -9 (EOL) the calculatedjump will be always -9
      2. You can verify if the calculated jumps are correct in this way:
        • If the jumpto is -1, it means that the calculatedjump must be the next page in the lesson id (according to the order).
        • If the jumpto is -40 it means that the calculatedjump must be the previous page in the lesson.
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings In a course create a lesson with at least two content pages and one question page. In the lesson settings, enable Availability -> Allow lesson to be attempted offline using the mobile app In the first page add links to the next page and end of lesson In the second page add links to a random page, the first page and the end of lesson Enrol one user as student in the course where the lesson is. 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). curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=4&wsfunction=mod_lesson_get_pages_possible_jumps&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Now check that calculatedjump for all the jumps is always a value > 0. There is an exception, when the jump is to -9 (EOL) the calculatedjump will be always -9 You can verify if the calculated jumps are correct in this way: If the jumpto is -1, it means that the calculatedjump must be the next page in the lesson id (according to the order). If the jumpto is -40 it means that the calculatedjump must be the previous page in the lesson.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57760-master

      Description

      Return all the possible jumps for the pages in a given lesson, this is to pre-calculate a path for users that will use the offline functionality.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Dani Palou
              Integrator:
              David Monllaó
              Tester:
              David Mudrák (@mudrd8mz)
              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