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

The condition_info class caches the user grade info too well

    Details

    • Testing Instructions:
      Hide

      You need two browser for testing, the purpose of the issue is to make sure that student does not need to re-login in order to gain access conditional items.

      Test for 2.6:

      1. Enable conditional availability on site
      2. Create a course with some graded activities, including
        1. assignment
        2. quiz that sets the grade automatically
        3. assignment with advanced grading
      3. Create a grading category and add some graded activities in it.
      4. Create other activities AND sections whose availability depends on the grades in modules and grade category total. Note: create only one grade condition in the item to test all cases separately.
      5. Enrol a student
      6. In another browser login as a student and make sure you can not see the activities and sections that have grade conditions
      7. Take and pass the quiz
      8. Make sure the activities and sections that depend on this quiz grade appear immediately.
      9. As teacher/admin in the first browser grade the student for assignment activities
      10. As student in the second browser make sure that access is immediately granted to the activities and sections that depend on assignment grades and grading category grade.

      Test for 2.5 and 2.4:

      Repeat the test but instead of "immediately" read it as "within 10 minutes". If you hack condition_info_base::get_cached_grade_score() you can decrease the timeout for testing purposes. The quiz should still grant access immediately.

      Show
      You need two browser for testing, the purpose of the issue is to make sure that student does not need to re-login in order to gain access conditional items. Test for 2.6: Enable conditional availability on site Create a course with some graded activities, including assignment quiz that sets the grade automatically assignment with advanced grading Create a grading category and add some graded activities in it. Create other activities AND sections whose availability depends on the grades in modules and grade category total. Note: create only one grade condition in the item to test all cases separately. Enrol a student In another browser login as a student and make sure you can not see the activities and sections that have grade conditions Take and pass the quiz Make sure the activities and sections that depend on this quiz grade appear immediately. As teacher/admin in the first browser grade the student for assignment activities As student in the second browser make sure that access is immediately granted to the activities and sections that depend on assignment grades and grading category grade. Test for 2.5 and 2.4: Repeat the test but instead of "immediately " read it as "within 10 minutes". If you hack condition_info_base::get_cached_grade_score() you can decrease the timeout for testing purposes. The quiz should still grant access immediately.
    • Workaround:
      Hide

      The student logs out and then back in.

      Show
      The student logs out and then back in.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:
      wip-MDL-28463-master

      Description

      Basically the use case is, the student has already logged in and the condition_info::get_cached_grade_score function has already cached the student's grade information. Then, the student's grade changes (maybe the teacher manually edits their grade in the gradebook), then any availability conditions that the new grade would satisfy will not be released to the student due to the caching. The student must logout/in.

      Since the grade can change during another user's session (like the teacher editing the grade), the solution to this problem is somewhat tricky. The cache probably has to be moved out of the user's session.

      Replication steps:

      1. Log in as admin/teacher in one browser
      2. Log in as a student in another browser
      3. Create two assignments
      4. In the second, create a condition that relies on a grade value in the first
      5. Go to the first assignment and mark an assignment for the student (there is no need for a student submission)
      6. As the student, refresh the page and check if the second assignment is accessible
      7. As the student, log out and log in again
      8. As the student, check if the second assignment is accessible

      Expected result: The second assignment should be accessible after the grade is set, even before logging in again

      Actual result: The second assignment is not accessible until logging in again

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  14 Vote for this issue
                  Watchers:
                  14 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13