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

get_h5pactivities_by_courses external method is not returning the correct package URL

XMLWordPrintable

    • MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • MDL-68855-master
    • Hide

      Notice: You need to be able to use CURL in a console.

      Setup

      1. Login as admin.
      2. Create a course "Course 1" and two H5P activities with the attached files.
      3. Create a teacher t1 user and enrolled in Course 1.
      4. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Create a token for the teacher t1  to service (Mobile Service).

      Tests: Package URL contains ITEMID 0.

      1. Do a CURL REST call simulating a WS client with the user.
        • You need to replace the WSTOKENSTEACHER (with the token for Teacher t1), COURSEID with the id of the course

          curl 'http://YOURMOODLESITE/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids[0]=COURSEID&wsfunction=mod_h5pactivity_get_h5pactivities_by_courses&wstoken=WSTOKENSTEACHER' | python -m "json.tool"

      1. Expected result: You should see two activities with a package object. Confirm in the fileurl attribute you could see a URL with a "0" between the string "package" and the "name of the H5P file". Something like:

        ......mod_h5pactivity/pacakge/0/find-the-words.h5p
        ......mod_h5pactivity/pacakge/0/filltheblanks.h5
        

      Show
      Notice: You need to be able to use CURL in a console. Setup Login as admin. Create a course "Course 1" and two H5P activities with the attached files. Create a teacher t1 user and enrolled in Course 1. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Click on Site administration ► Plugins ► Web services ► Manage tokens Create a token for the teacher t1  to service (Mobile Service). Tests: Package URL contains ITEMID 0. Do a CURL REST call simulating a WS client with the user. You need to replace the WSTOKENSTEACHER (with the token for Teacher t1), COURSEID with the id of the course curl 'http://YOURMOODLESITE/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids [0] =COURSEID&wsfunction=mod_h5pactivity_get_h5pactivities_by_courses&wstoken=WSTOKENSTEACHER' | python -m "json.tool" Expected result: You should see two activities with a package object. Confirm in the fileurl attribute you could see a URL with a "0" between the string "package" and the "name of the H5P file". Something like: ......mod_h5pactivity/pacakge/ 0 /find-the-words.h5p ......mod_h5pactivity/pacakge/ 0 /filltheblanks.h5
    • Moppies Kanban

      Dani has found an issue with get_h5pactivities_by_courses.php::execute(): the package URL is not correct because the itemid (=0) is not there.

      For fixing it, the last parameter in this line should be set to true (to include the itemid in the URL).

        1. filltheblanks.h5p
          699 kB
          Carlos Escobedo
        2. find-the-words.h5p
          617 kB
          Carlos Escobedo
        3. image-2020-05-29-12-21-00-160.png
          103 kB
          Janelle Barcega

            cescobedo Carlos Escobedo
            sarjona Sara Arjona (@sarjona)
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h

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