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

ORA-00918 filtering in hotpot analysis report

XMLWordPrintable

    • MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE

      When filtering from the Item analysis screen in the hotpot module (mod/hotpot/report.php?id=x&mode=analysis), 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, ROUND(gg.rawgrade, 0) AS grade, u.id AS userid, u.firstname, u.lastname, u.picture, u.imagealt, u.email
      FROM m2hotpot_attempts ha, m2grade_items gi, m2grade_grades gg, m2user u
      WHERE ha.hotpotid=:o_hotpotid AND ha.userid=gg.userid AND gg.itemid=gi.id AND gi.courseid=:o_courseid AND gi.itemtype=:o_itemtype AND gi.itemmodule=:o_itemmodule AND gi.iteminstance=:o_iteminstance AND ha.userid=u.id
      ORDER BY u.firstname, u.lastname, ha.attempt ASC)
      WHERE rownum <= :o_oracle_num_rows
      [array (
      'o_hotpotid' => '1',
      'o_courseid' => '124',
      'o_itemtype' => 'mod',
      'o_itemmodule' => 'hotpot',
      'o_iteminstance' => '1',
      'o_oracle_num_rows' => 30,
      )]
      Error code: dmlreadexception
      Stack trace:
      line 407 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 1101 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      line 1362 of /lib/tablelib.php: call to oci_native_moodle_database->get_records_sql()
      line 152 of /mod/hotpot/report/renderer.php: call to table_sql->query_db()
      line 88 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.3.1 and Oracle.

      To fix this problem we've edited the mod/hotpot/lib.php file and, in the function hotpot_get_recent_mod_activity, we've changed the following line (645):
      $select = 'ha.*, '.$duration.', u.firstname, u.lastname, u.picture, u.imagealt, u.email';

      by this other:
      $select = 'ha.id, ha.hotpotid, ha.starttime,ha.endtime, ha.score, ha.penalties, ha.attempt, ha.timestart, ha.timefinish, ha.status, ha.clickreportid, ha.timemodified, '.$duration.', u.firstname, u.lastname, u.picture, u.imagealt, u.email';

      because the problem is the ha.userid column which also is defined in the $filter variable as u.userid.

            xxxxxxx Gordon Bateson
            sarjona Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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