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

log stores should always order by ID when reading events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.7
    • 2.7
    • Logging
    • MOODLE_27_STABLE
    • MOODLE_27_STABLE
    • w17_MDL-45214_m27_idsortlog
    • Hide

      1/ execute phpunit tests
      2/ go to log and live log report and verify they do not throw any warnings and events from one page appear to be sorted properly (for example you may try to change password - the user updated should be before password updated)

      Show
      1/ execute phpunit tests 2/ go to log and live log report and verify they do not throw any warnings and events from one page appear to be sorted properly (for example you may try to change password - the user updated should be before password updated)

      The problem is that sorting events by time is not enough because PostgreSQL may then return events from one page in random order.

      solution is to do something like:

          public function get_events_select($selectwhere, array $params, $sort, $limitfrom, $limitnum) {
              global $DB;
       
              if (empty($sort)) {
                  $sort = "id ASC";
              } else if (stripos($sort, 'DESC') !== false) {
                  $sort .= ", id DESC";
              } else {
                  $sort .= ", id ASC";
              }
      

      Example: when using PG events from one page are printed out in random order in the livelog report.

            skodak Petr Skoda
            skodak Petr Skoda
            Ankit Agarwal Ankit Agarwal
            Sam Hemelryk Sam Hemelryk
            Simey Lameze Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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