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

get_h5pactivities_by_courses external method is not returning the correct package URL

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.9
    • 3.9
    • H5P
    • 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

    Description

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

      Attachments

        Activity

          People

            cescobedo Carlos Escobedo
            sarjona Sara Arjona (@sarjona)
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              15/Jun/20

              Time Tracking

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