Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-4910

ORA-00918 in hotpot reporting

XMLWordPrintable

    • 2014.02.10 (00)
    • MOODLE_24_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE

      When entering report overview (/mod/hotpot/report.php?id=x&mode=overview), we get the following error (with the Debugging developer activated):

      Debug info: ORA-00918: column ambiguously defined
      SELECT *
      FROM (SELECT
      ha.*, (ha.timemodified - ha.timestart) AS duration, (CASE WHEN gg.rawgrade IS NULL THEN 0 ELSE ROUND(gg.rawgrade, 0) END) AS grade, u.id AS userid,u.picture,u.firstname,u.lastname,u.imagealt,u.email
      FROM m2hotpot_attempts ha INNER JOIN m2user u ON ha.userid = u.id LEFT JOIN m2grade_items gi ON gi.courseid = :o_courseid AND gi.itemtype = :o_itemtype AND gi.itemmodule = :o_itemmodule AND gi.iteminstance = :o_iteminstance LEFT JOIN m2grade_grades gg ON gg.itemid = gi.id AND gg.userid = ha.userid
      WHERE ha.hotpotid=:o_hotpotid AND ha.userid=u.id
      ORDER BY u.firstname, u.lastname, ha.attempt ASC)
      WHERE rownum <= :o_oracle_num_rows
      [array (
      'o_courseid' => '42',
      'o_itemtype' => 'mod',
      'o_itemmodule' => 'hotpot',
      'o_iteminstance' => '801',
      'o_hotpotid' => '801',
      'o_oracle_num_rows' => 30,
      )]
      Error code: dmlreadexception
      Stack trace:
      line 426 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 274 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
      line 1119 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      line 1422 of /lib/tablelib.php: call to oci_native_moodle_database->get_records_sql()
      line 162 of /mod/hotpot/report/renderer.php: call to table_sql->query_db()
      line 98 of /mod/hotpot/report/renderer.php: call to mod_hotpot_report_renderer->reportcontent()
      line 93 of /mod/hotpot/report.php: call to mod_hotpot_report_renderer->render_report()
      

      We've Moodle 2.4.8 and Oracle.
      To fix this problem we've edited the mod/hotpot/report/renderer.php file and, in the function select_sql, we've changed the following line (346):

      $userfields = ', '.$this->get_userfields('u', null, 'userid');
      

      by this other:

      $userfields = ', '.$this->get_userfields('u', null, 'userid2');
      

      because the problem is the ha.userid column which also is defined as u.userid.

            xxxxxxx Gordon Bateson
            pferre22 Pau Ferrer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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