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

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9
    • Fix Version/s: 3.9
    • Component/s: H5P
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull Master Branch:
      MDL-68855-master
    • Sprint:
      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

            Assignee:
            cescobedo Carlos Escobedo
            Reporter:
            sarjona Sara Arjona (@sarjona)
            Peer reviewer:
            Sara Arjona (@sarjona)
            Integrator:
            Jun Pataleta
            Tester:
            Janelle Barcega
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              15/Jun/20

                Time Tracking

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