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

Course report - participation report, breaks when selecting some English letter from the "First Name" filter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.6, 2.1.3
    • 2.0.5, 2.1.2, 2.2
    • Course, Logging, Reports
    • None
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • Hide

      1/ Create a course with 30 students enrolled
      2/ Do some activity
      3/ Go to course admin ► Reports ► Participation report
      4/ Display some participation records by choosing appropiate options
      5/ Filter results by firstname

      Expected result
      ------------------
      Results are displayed filtered by firstname

      Actual result
      --------------
      SQL error

      Show
      1/ Create a course with 30 students enrolled 2/ Do some activity 3/ Go to course admin ► Reports ► Participation report 4/ Display some participation records by choosing appropiate options 5/ Filter results by firstname Expected result ------------------ Results are displayed filtered by firstname Actual result -------------- SQL error

      I was getting an SQL error:

      Debug info: Unknown column 'firstname' in 'where clause'
      SELECT COUNT(DISTINCT(ra.userid))
      FROM mdl_role_assignments ra
       
      WHERE ra.contextid IN (661,2524,1) AND ra.roleid = ? AND firstname LIKE ? ESCAPE '\\'
      [array (
      0 => 16,
      1 => 'A%',
      )]
      Stack trace:
      line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 794 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1280 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
      line 1355 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1526 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      line 232 of /course/report/participation/index.php: call to moodle_database->count_records_sql()

      by added the line "JOIN

      {user} u ON u.id = ra.userid" just after line 225 that is : "FROM {role_assignments} ra"
      Issue was solved

      see full code at line 224:

       

      $countsql = "SELECT COUNT(DISTINCT(ra.userid))
      FROM {role_assignments} ra
      JOIN {user}

      u ON u.id = ra.userid
      WHERE ra.contextid $relatedcontexts AND ra.roleid = :roleid";

       

            poltawski Dan Poltawski
            nadavkav Nadav Kavalerchik
            Aparup Banerjee Aparup Banerjee
            Ankit Agarwal Ankit Agarwal
            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.