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

core_course_get_course_module doesn't return availability conditions for students

    XMLWordPrintable

Details

    • MOODLE_311_STABLE

    Description

      We are currently working on integrating Moodle into our own app. There we noticed an inconsistency between what info you, as a student, see about an activity on the course page versus through webservice functions. On the course page you see e.g. when an activity will become available (unless the activity is configured to be hidden when the access condition is not fulfilled) whereas if you call core_course_get_course_module or core_course_get_course_module_by_instance you only get:

       

      {
          "exception": "require_login_exception",
          "errorcode": "requireloginerror",
          "message": "Course or activity not accessible."
      }

       

      It would be nice if these webservice functions would give you the same course_module information that you can see when looking at that activity on the course main page. Example:

      (See attached "restricted-activity.png".)

      {
          "cm": {
              "id": 17060,
              "course": 13825,
              "module": 1,
              "name": "Aufgabe",
              "modname": "assign",
              "instance": 424,
              "section": 68203,
              "sectionnum": 1,
              "groupmode": 0,
              "groupingid": 0,
              "completion": 1,
              "availability": "{\"op\":\"&\",\"c\":[{\"type\":\"date\",\"d\":\"<\",\"t\":1646954400}]}"
          },
          "warnings": []
      } 

       
      Since both of these webservice functions are used in the Moodle app we have to make sure this change doesn't break anything there.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tschroeder Tim Schroeder
            Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona), Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: