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

Error viewing Grade User Report

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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: Gradebook
    • Labels:
    • Environment:
      Windows 2003, IIS6, PHP 5.3.0, SQL Server 2008, Moodle 2.0.3+
    • Database:
      PostgreSQL, Microsoft SQL
    • Testing Instructions:
      Hide

      Requires testing on postgres or SQL Server

      As an admin go into a course with at least one student and at least one gradeable activity. Go into the gradebook and via the gradebook nav drop down go to the settings and ensure that average column in the user report is set to "show"

      From course admin > Users - Enrolled users
      Click on the picture located next to Student ie their profile pic to get to their profile
      in left hand menu, select Login as - continue
      select Grades

      grade averages should be displayed.

      Show
      Requires testing on postgres or SQL Server As an admin go into a course with at least one student and at least one gradeable activity. Go into the gradebook and via the gradebook nav drop down go to the settings and ensure that average column in the user report is set to "show" From course admin > Users - Enrolled users Click on the picture located next to Student ie their profile pic to get to their profile in left hand menu, select Login as - continue select Grades grade averages should be displayed.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull Master Branch:
      MDL-27703_user_report_sql

      Description

      Moodle throws an exception when accessing the user report page within the grades.

      The following error is thrown from the page https://shymoodle.upmc.com/grade/report/user/index.php?id=6:

      Default exception handler: Error reading from database Debug: Incorrect syntax near the keyword 'WHERE'. SELECT gi.id, COUNT(u.id) AS count FROM moodle_grade_items gi JOIN moodle_user u JOIN (SELECT DISTINCT eu2_u.id FROM moodle_user eu2_u JOIN moodle_user_enrolments eu2_ue ON eu2_ue.userid = eu2_u.id JOIN moodle_enrol eu2_e ON (eu2_e.id = eu2_ue.enrolid AND eu2_e.courseid = ?) WHERE eu2_u.deleted = 0 AND eu2_u.id <> ?) je ON je.id = u.id JOIN ( SELECT DISTINCT ra.userid FROM moodle_role_assignments ra WHERE ra.roleid IN (?,?,?,?,?,?,?) AND ra.contextid IN (205,3,1) ) rainner ON rainner.userid = u.id LEFT JOIN moodle_grade_grades gg ON (gg.itemid = gi.id AND gg.userid = u.id AND gg.finalgrade IS NOT NULL AND gg.hidden = 0) WHERE gi.courseid = ? AND u.deleted = 0 AND gg.finalgrade IS NULL GROUP BY gi.id [array ( 0 => '6', 1 => '1', 2 => '6', 3 => '4', 4 => '2', 5 => '5', 6 => '7', 7 => '3', 8 => '1', 9 => 6, )] * line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown * line 255 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end() * line 710 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end() * line 739 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql() * line 670 of \grade\report\user\lib.php: call to mssql_native_moodle_database->get_records_sql() * line 217 of \grade\report\user\lib.php: call to grade_report_user->calculate_averages() * line 121 of \grade\report\user\index.php: call to grade_report_user->__construct() 

      Replication instructions:

      1. Login to moodle dev
      2. under MY Courses, select "A New Start" course
      3. under Settings (top left hand side of page) select Grades (logged in as a student, this is where the error occurs, for error as admin, please continue)
      4. Select user report (Top left of page) (error will appear)

      or

      1. login as a student:
      2. In the new start course
      3. select Users - Enrolled users (menu on left)
      4. Click on the picture located next to StudentSON
      5. on left hand menu, select Login as - continue
      6. select Grades, (Error message)

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

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