Moodle
  1. Moodle
  2. MDL-29812

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.5, 2.1.2, 2.2
    • Fix Version/s: 2.0.6, 2.1.3
    • Component/s: Course
    • Labels:
      None
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Rank:
      19338

      Description

      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";

      
      

        Activity

        Hide
        Dan Poltawski added a comment -

        Note, this needs to have more than per page users to reproduce it

        Show
        Dan Poltawski added a comment - Note, this needs to have more than per page users to reproduce it
        Hide
        Dan Poltawski added a comment -

        Integrators: this can be cherry picked into 20_STABLE and master

        Show
        Dan Poltawski added a comment - Integrators: this can be cherry picked into 20_STABLE and master
        Hide
        Eloy Lafuente (stronk7) added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Nadav Kavalerchik added a comment -

        Thanks Eloy

        Show
        Nadav Kavalerchik added a comment - Thanks Eloy
        Hide
        Aparup Banerjee added a comment -

        Thanks for the report and fix guys!
        This has been integrated now and up for testing.

        Show
        Aparup Banerjee added a comment - Thanks for the report and fix guys! This has been integrated now and up for testing.
        Hide
        Ankit Agarwal added a comment -

        all Looking good!
        Passing
        Thanks!

        Show
        Ankit Agarwal added a comment - all Looking good! Passing Thanks!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Somebody is allergic to use the "Test passed" transition button, lol!

        Show
        Eloy Lafuente (stronk7) added a comment - Somebody is allergic to use the "Test passed" transition button, lol!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Yes, you got this finally upstream, just in time for Moodle 2.2beta. Congrats and thanks!

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Yes, you got this finally upstream, just in time for Moodle 2.2beta. Congrats and thanks! Ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: