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

Block grade_me crashes when a quiz exists (MOODLE_27_STABLE branch)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 2.7.2
    • Block: Grade me
    • None
    • 2014051200
    • MOODLE_27_STABLE

      Environment: ubuntu / apache / postgres 9.3

      Install Moodle : MOODLE_27_STABLE branch
      As admin create a course + a quiz
      Install grade_me block : MOODLE_27_STABLE branch
      Add block to the course

      You see this error:

      Debug info: ERROR: column "mdl_question_attempt_steps.userid" must appear in the GROUP BY clause or be used in an aggregate function
      LINE 7: SELECT userid, questionattemptid, MAX(sequencenu...
      ^
      SELECT bgm.courseid, bgm.coursename, bgm.itemmodule, bgm.iteminstance, bgm.itemname, bgm.coursemoduleid, bgm.itemsortorder, qa.id state_id, qa.userid, qa.timemodified timesubmitted, q.id submissionid, qas.sequencenumber
      FROM mdl_quiz_attempts qa
      JOIN mdl_quiz q ON q.id = qa.quiz
      LEFT JOIN mdl_block_grade_me bgm ON bgm.courseid = q.course AND bgm.iteminstance = q.id
      JOIN mdl_question_attempt_steps qas ON qas.questionattemptid = qa.id
      JOIN (
      SELECT userid, questionattemptid, MAX(sequencenumber) as maxseqnum
      FROM mdl_question_attempt_steps
      GROUP BY questionattemptid
      ) maxsubq ON maxsubq.questionattemptid = qa.id
      WHERE qa.userid = $1
      AND qa.state = 'finished'
      AND maxsubq.maxseqnum = qas.sequencenumber AND qa.timefinish != 0 AND maxsubq.userid = qas.userid
      AND qas.state NOT IN('mangrright',
      'gradedright',
      'gradedwrong',
      'mangrwrong') AND bgm.courseid = $2
      AND bgm.itemmodule = 'quiz'
      [array (
      0 => 5,
      1 => 2,
      )]
      Error code: dmlreadexception
      Stack trace:
      line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 723 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 109 of /blocks/grade_me/block_grade_me.php: call to pgsql_native_moodle_database->get_recordset_sql()
      line 294 of /blocks/moodleblock.class.php: call to block_grade_me->get_content()
      line 236 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
      line 993 of /lib/blocklib.php: call to block_base->get_content_for_output()
      line 1045 of /lib/blocklib.php: call to block_manager->create_block_contents()
      line 361 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
      line 45 of /theme/clean/layout/columns3.php: call to core_renderer->standard_head_html()
      line 877 of /lib/outputrenderers.php: call to include()
      line 807 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
      line 243 of /course/view.php: call to core_renderer->header()

      This may be a fix: http://stackoverflow.com/a/19602031 ( I didn't look at the big SQL query so it may not be a valid fix at all)

      PS: thanks for the plugin, it's a great feature!

            tbannister Tyler Bannister
            jerome Jérôme Mouneyrac
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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