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

Lesson check_updates callback is failing when the activity uses separated groups

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.3.2
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a new empty course forced to use separate groups
      2. Create two groups in the course: g1 and g2
      3. Now, enrol a user as teacher
      4. Enrol two users in the course (u1 and u2) as students, add the u1 to the group g1 and the u2 to the group g2
      5. Create a lesson in the course with just one question page (any type of question except essay)
      6. Take the lesson with u1 and u2
      7. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      8. Create a Token in the mobile app service for the teacher user in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      9. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, the course id, the since with a timestamp value from a day ago and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=17&since=1476274596&wsfunction=core_course_get_updates_since&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' | python -m "json.tool"

      10. Confirm that you receive updates for both users in the course. For example, in usertimers you see two items. In userquestionattempts you see 2 items too.
      11. Now, unassign (prohibit) the moodle/site:accessallgroups capability in the course for the teacher role.
      12. Enrol the teacher in the group g1
      13. Execute again the curl request and now check that you only get 1 item in usertimers or userquestionattempts (you get just one now because you can see the u1 right now)
      Show
      Create a new empty course forced to use separate groups Create two groups in the course: g1 and g2 Now, enrol a user as teacher Enrol two users in the course (u1 and u2) as students, add the u1 to the group g1 and the u2 to the group g2 Create a lesson in the course with just one question page (any type of question except essay) Take the lesson with u1 and u2 As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the teacher user 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 user. You need to replace the wstoken, the course id, the since with a timestamp value from a day ago and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=17&since=1476274596&wsfunction=core_course_get_updates_since&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' | python -m "json.tool" Confirm that you receive updates for both users in the course. For example, in usertimers you see two items. In userquestionattempts you see 2 items too. Now, unassign (prohibit) the moodle/site:accessallgroups capability in the course for the teacher role. Enrol the teacher in the group g1 Execute again the curl request and now check that you only get 1 item in usertimers or userquestionattempts (you get just one now because you can see the u1 right now)
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59532-master

      Description

      There are a couple of incorrect SQL queries when the user calling the function is a teacher and the activity uses separate groups.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Sep/17