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

It is not possible to retrieve via WebServices the options in the new course overview block custom field filter

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.8
    • Fix Version/s: 3.8
    • Component/s: Blocks
    • Labels:
    • Testing Instructions:
      Hide
      Test
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Create one custom field (type short text) for courses via Site Administration > Courses > Course custom fields
      4. Create a couple of courses in the site setting some random and different values to the custom field you created
      5. Enrol the user you created the token for in those courses
      6. Go to Site Administration > Plugins > Blocks > Manage Blocks
      7. Ensure that the Course overview block is enabled
      8. Open the settings of the block and enable the option: "Custom field" and select from the dropdown menu the course custom field you created before
      9. Now, as the user you created the token for in step 2 access the web site
      10. Go to dashboard and check that you see the "Course overview" block.
        #Confirm that:
        • Among the course filters you will see the custom field values you typed for the courses
      11. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool"

      12. Please confirm that:
        • In the curl response you see the list of blocks in the user Dashboard
        • For the "courseoverview" block you see a field named "customfieldsexport" that is a JSON encoded string that contains all the course custom fields values you entered when you created the courses
      Show
      Test As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Create one custom field (type short text) for courses via Site Administration > Courses > Course custom fields Create a couple of courses in the site setting some random and different values to the custom field you created Enrol the user you created the token for in those courses Go to Site Administration > Plugins > Blocks > Manage Blocks Ensure that the Course overview block is enabled Open the settings of the block and enable the option: "Custom field" and select from the dropdown menu the course custom field you created before Now, as the user you created the token for in step 2 access the web site Go to dashboard and check that you see the "Course overview" block. #Confirm that: Among the course filters you will see the custom field values you typed for the courses Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool" Please confirm that: In the curl response you see the list of blocks in the user Dashboard For the "courseoverview" block you see a field named "customfieldsexport" that is a JSON encoded string that contains all the course custom fields values you entered when you created the courses
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-67047-master

      Description

      In MDL-66017 a new filter based on custom course fields was introduced for Moodle 3.8.

      Currently, there is no way to get all the potential options (names and values) so we can display them in external clients like the Moodle app.

      The only way to fix this would be to return the possible options and values as a JSON encoded string as part of the block plugin settings that are returned via Web Services when retrieving the blocks(thanks to the recent changes in MDL-65400)

      This is partially blocking MOBILE-3190

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Pau Ferrer
              Integrator:
              Adrian Greeve
              Tester:
              Gladys Basiana
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 55 minutes
                  4h 55m