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

Participants filter for last access to course doesn't work correctly

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79681-403
    • Hide
      1. Log in as admin
      2. Create two new users:
        • Username: user01
        • Username: user02
      3. Run the following update in your database:

        UPDATE moodle.m_user SET lastaccess = 1672578000 WHERE username = 'user01'
        

      4. Press Home in primary navigation to visit site homepage
      5. Press Participants
      6. Set the following filter:
        • Match: Any
        • Inactive for more than
        • Never
      7. Press Apply
      8. Confirm only user02 shows in the participants table
      Show
      Log in as admin Create two new users: Username: user01 Username: user02 Run the following update in your database: UPDATE moodle.m_user SET lastaccess = 1672578000 WHERE username = 'user01' Press Home in primary navigation to visit site homepage Press Participants Set the following filter: Match: Any Inactive for more than Never Press Apply Confirm only user02 shows in the participants table

      There are two problems with the course participants filter when used inside a course (as opposed to the site front page):

      1. The conditional for checking the current course is wrong (as described in MDL-75536);
      2. The generated SQL for determining whether a user had never accessed a course was wrong (because the user_lastaccess record would not exist at all, so the Never option was broken as described in MDL-71088)

      Original report

      Open file - /user/classes/output/participants_filter.php, go to get_accesssince_filter() method.

      1) Condition is incorrect - "if (!$this->course->id == SITEID)".

      2) The condition for getting not active participants is incorrect:

      $params = [
                      'courseid' => $this->course->id,
                      'timeaccess' => 0,
                  ];

       

      In this case, rows with "timeaccess=0" condition do not exist. Need to change condition, for example, use join with tables {user_enrolments}, {enrol}

      We noticed a problem when we tried to select course participants due to "Inactivity for more than Never"

            pholden Paul Holden
            fidan Synbulatov Fidan
            Andrew Lyons Andrew Lyons
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 26 minutes
                1h 26m

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