Moodle
  1. Moodle
  2. MDL-27153

Export Grades, Preview has the message 'Error reading from database' - rainnner

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Gradebook
    • Labels:
      None
    • Environment:
      NA
    • Database:
      Any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      17222

      Description

      line 161 in grade/lib.php

      "rainnner ON rainner.userid = u.id"

      rainnner should be spelt rainner

      To reproduce:

      Go to a course, export grades as a plain text file. On the preview page, the error appears.

        Issue Links

          Activity

          Hide
          Andrew Davis added a comment -

          2.0 version

          repo: git://github.com/andyjdavis/moodle.git
          branch: MDL-27153_grade_export_preview_sql
          diff: https://github.com/andyjdavis/moodle/compare/MOODLE_20_STABLE...MDL-27153_grade_export_preview_sql

          Show
          Andrew Davis added a comment - 2.0 version repo: git://github.com/andyjdavis/moodle.git branch: MDL-27153 _grade_export_preview_sql diff: https://github.com/andyjdavis/moodle/compare/MOODLE_20_STABLE...MDL-27153_grade_export_preview_sql
          Hide
          Andrew Davis added a comment -

          2.1 version

          repo: git://github.com/andyjdavis/moodle.git
          branch: MDL-27153_grade_export_preview_sql_MASTER
          diff: https://github.com/andyjdavis/moodle/compare/master...MDL-27153_grade_export_preview_sql_MASTER

          Show
          Andrew Davis added a comment - 2.1 version repo: git://github.com/andyjdavis/moodle.git branch: MDL-27153 _grade_export_preview_sql_MASTER diff: https://github.com/andyjdavis/moodle/compare/master...MDL-27153_grade_export_preview_sql_MASTER
          Hide
          Andrew Davis added a comment -

          Thankyou for the report bunwich

          Ive create pull requests for consideration by the integrators.
          PULL-653 PULL-654

          Show
          Andrew Davis added a comment - Thankyou for the report bunwich Ive create pull requests for consideration by the integrators. PULL-653 PULL-654
          Hide
          Paul Taylor added a comment -

          Hi:

          Looks like there is an issue related to this. I am getting the error and no export as are some other users in this forum:

          http://moodle.org/mod/forum/discuss.php?d=173281&parent=759396

          Error message is:

          Debug info: Unknown column 'rainner.userid' in 'on clause'
          SELECT g.* , u.lastname AS usrt1, u.firstname AS usrt2, u.id AS usrt
          FROM mdl_grade_grades g
          JOIN mdl_user u ON g.userid = u.id
          JOIN (SELECT DISTINCT eu1_u.id
          FROM mdl_user eu1_u
          JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
          JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = ?)
          WHERE eu1_u.deleted = 0 AND eu1_u.id <> ?) je ON je.id = u.id

          JOIN (
          SELECT DISTINCT ra.userid
          FROM mdl_role_assignments ra
          WHERE ra.roleid = ?
          AND ra.contextid IN (16,3,1)
          ) rainnner ON rainner.userid = u.id
          WHERE u.deleted = 0
          AND g.itemid IN (?,?,?)

          ORDER BY usrt1 ASC, usrt2 ASC, usrt ASC, g.itemid ASC
          [array (
          0 => '2',
          1 => '1',
          2 => '5',
          3 => 26,
          4 => 27,
          5 => 25,
          )]
          Stack trace:

          line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 749 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
          line 166 of /grade/lib.php: call to mysqli_native_moodle_database->get_recordset_sql()
          line 225 of /grade/export/lib.php: call to graded_users_iterator->init()
          line 59 of /grade/export/xls/index.php: call to grade_export->display_preview()

          Show
          Paul Taylor added a comment - Hi: Looks like there is an issue related to this. I am getting the error and no export as are some other users in this forum: http://moodle.org/mod/forum/discuss.php?d=173281&parent=759396 Error message is: Debug info: Unknown column 'rainner.userid' in 'on clause' SELECT g.* , u.lastname AS usrt1, u.firstname AS usrt2, u.id AS usrt FROM mdl_grade_grades g JOIN mdl_user u ON g.userid = u.id JOIN (SELECT DISTINCT eu1_u.id FROM mdl_user eu1_u JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = ?) WHERE eu1_u.deleted = 0 AND eu1_u.id <> ?) je ON je.id = u.id JOIN ( SELECT DISTINCT ra.userid FROM mdl_role_assignments ra WHERE ra.roleid = ? AND ra.contextid IN (16,3,1) ) rainnner ON rainner.userid = u.id WHERE u.deleted = 0 AND g.itemid IN (?,?,?) ORDER BY usrt1 ASC, usrt2 ASC, usrt ASC, g.itemid ASC [array ( 0 => '2', 1 => '1', 2 => '5', 3 => 26, 4 => 27, 5 => 25, )] Stack trace: line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown line 749 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 166 of /grade/lib.php: call to mysqli_native_moodle_database->get_recordset_sql() line 225 of /grade/export/lib.php: call to graded_users_iterator->init() line 59 of /grade/export/xls/index.php: call to grade_export->display_preview()
          Hide
          Paul Taylor added a comment -

          Sorry, upgrade to 20/04 codebase fixed the problem.

          Show
          Paul Taylor added a comment - Sorry, upgrade to 20/04 codebase fixed the problem.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: