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

Function data_search_entries is not calculating correctly the totalcount

    XMLWordPrintable

Details

    • MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-59627-master
    • 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 at least 3 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)
      8. If you execute the curl request removing the &search=X, totalcount should match the number of entries returned as well
      9. If you search for a text that doesn't exit totalcount should be set to 0

      Now, in the web interface check that the pagination when you do a Search in the View tab works as expected:

      1. Create new entries in the database (minium a total of 5 entries required)
      2. Set "Entries per page" to 2 and then do a search in the View tab. The search should match at least 3 entries.
      3. Check that you see search 2 pages and you can navigate between the.
      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 at least 3 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) If you execute the curl request removing the &search=X, totalcount should match the number of entries returned as well If you search for a text that doesn't exit totalcount should be set to 0 Now, in the web interface check that the pagination when you do a Search in the View tab works as expected: Create new entries in the database (minium a total of 5 entries required) Set "Entries per page" to 2 and then do a search in the View tab. The search should match at least 3 entries. Check that you see search 2 pages and you can navigate between the.

    Description

      It seems that it only calculates it well when using advanced search, when using normal search is returning the same value that maxcount.

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Dani Palou Dani Palou
              Dan Poltawski Dan Poltawski
              Damyon Wiese Damyon Wiese
              Amaia Anabitarte, Carlos Escobedo, Laurent David, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/Sep/17