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

Activity dates returned via Web Services are missing some existing fields and an identificative field

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-75058-master
    • Hide
      Test
      1. As an admin, go to Site administration and search for "enablemobilewebservice". Enable web services for mobile devices and save the changes
      2. Go to Site administration / Development / Experimental / Experimental settings and Enable course relative dates. Save the changes.
      3. Create a new course and set the setting "Relative dates mode" to yes
      4. Create a choice activity enabling the fields: Availability -> Allow responses from/until (you can use any future date)
      5. Create a forum activity enabling the field: Availability -> Due date (you can use any future date
      6. Create an Assignment activity enabling the fields: Availability -> Allow submissions from and Due date (you can use any future date)
      7. Enrol one user as Teacher
      8. Go to Site administration / Server / Web services / Manage tokens
      9. Create a Token in the mobile app service for the previous user (the teacher)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      10. Open the console and execute this new curl request, replacing WS_TOKEN with the token you just created and the SITE_URL with yours. Also replace COURSE_ID with the id of the course you created in the previous steps

        curl 'SITE_URL/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_get_contents' --data-raw 'courseid=COURSE_ID&wstoken=WS_TOKEN&moodlewssettingfilter=true&moodlewssettingfileurl=true&moodlewssettinglang=en&wsfunction=core_course_get_contents' | python -m "json.tool"

      11. Confirm that:
      12. In the curl request response you see the following:
        • For the Choice activity, a "dates" structure containing fields in which dataid is set to timeopen and timeclose
        • For the Forum activity, a "dates" structure containing a field in which dataid is set to duedata
        • For the Assignment activity, a "dates" structure containing fields in which dataid is set to allowsubmissionsfromdate, duedate and relativeto
      Show
      Test As an admin, go to Site administration and search for " enablemobilewebservice ". Enable web services for mobile devices and save the changes Go to Site administration / Development / Experimental / Experimental settings and Enable course relative dates. Save the changes. Create a new course and set the setting "Relative dates mode" to yes Create a choice activity enabling the fields: Availability -> Allow responses from/until (you can use any future date) Create a forum activity enabling the field: Availability -> Due date (you can use any future date Create an Assignment activity enabling the fields: Availability -> Allow submissions from and Due date (you can use any future date) Enrol one user as Teacher Go to Site administration / Server / Web services / Manage tokens Create a Token in the mobile app service for the previous user (the teacher) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console and execute this new curl request, replacing WS_TOKEN with the token you just created and the SITE_URL with yours. Also replace COURSE_ID with the id of the course you created in the previous steps curl 'SITE_URL/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_course_get_contents' --data-raw 'courseid=COURSE_ID&wstoken=WS_TOKEN&moodlewssettingfilter=true&moodlewssettingfileurl=true&moodlewssettinglang=en&wsfunction=core_course_get_contents' | python -m "json.tool" Confirm that: In the curl request response you see the following: For the Choice activity, a "dates" structure containing fields in which dataid is set to timeopen and timeclose For the Forum activity, a "dates" structure containing a field in which dataid is set to duedata For the Assignment activity, a "dates" structure containing fields in which dataid is set to allowsubmissionsfromdate, duedate and relativeto

      The existing Web Service core_course_get_contents is currently returning a structure called "dates" that contains the label and timestamp fields for a specific date.

      There are a couple of problems right now:

      • Is missing the relativeto field (that is currently used only by the assignment module)
      • Is not possible to identify to what corresponds the date, if is a timeopen/timeclose/duedate or whatever date that a particular module sets based on the activity settings.

      The previous two aspects are preventing external systems from properly and efficiently managing those dates. It is missing some required information such as the relativeto field and is not able to distinguish for what purpose is the given date.

        1. 12-1-MDL-75058_master-1.png
          12-1-MDL-75058_master-1.png
          79 kB
        2. 12-1-MDL-75058_v400-1.png
          12-1-MDL-75058_v400-1.png
          80 kB
        3. 12-2-MDL-75058_master-1.png
          12-2-MDL-75058_master-1.png
          70 kB
        4. 12-2-MDL-75058_v400-1.png
          12-2-MDL-75058_v400-1.png
          71 kB
        5. 12-3-MDL-75058_master-1.png
          12-3-MDL-75058_master-1.png
          87 kB
        6. 12-3-MDL-75058_v400-1.png
          12-3-MDL-75058_v400-1.png
          88 kB

            jleyva Juan Leyva
            jleyva Juan Leyva
            Rodrigo Mady Rodrigo Mady
            Jun Pataleta Jun Pataleta
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.