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

WS mod_data_search_entries is not returning the calculated maxcount value

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a course with a database using the image gallery preset
      2. Enrol a couple of users as teacher and student in that course
      3. As the student or teacher add a couple of entries to the database
      4. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token in the mobile app service for the student in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student.
        • You need to replace the wstoken, databaseid (database instance id), the TEXTTOSEARCH with a text matching one of the images names and the URL of your moodle instance

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

      7. Now check that the totalcount match with the number of entries returned (if you found 1 entry, it should say 1). maxcount should match the number of total entries the user should be able to see in the database
      8. If you execute the curl request removing the &search=X, totalcount should match the number of entries returned as well, in this case it should be the same that maxcount
      9. If you search for a text that doesn't exit totalcount should be set to 0 and maxcount again should be the number of total entries the user should be able to see
      Show
      Create a course with a database using the image gallery preset Enrol a couple of users as teacher and student in that course As the student or teacher add a couple of entries to the database Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student in the course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student. You need to replace the wstoken, databaseid (database instance id), the TEXTTOSEARCH with a text matching one of the images names and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'databaseid=8&wsfunction=mod_data_search_entries&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&search=TEXTTOSEARCH' | python -m "json.tool" Now check that the totalcount match with the number of entries returned (if you found 1 entry, it should say 1). maxcount should match the number of total entries the user should be able to see in the database If you execute the curl request removing the &search=X, totalcount should match the number of entries returned as well, in this case it should be the same that maxcount If you search for a text that doesn't exit totalcount should be set to 0 and maxcount again should be the number of total entries the user should be able to see
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59624-master

      Description

      Inside the WS we calculate the maxcount but we don't return it in the WS

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17