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

Quiz reports Highest Grade etc. does not work in Oracle, and uses ORDER BY id

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.5, 2.7
    • Fix Version/s: 2.6.4, 2.7.1
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      This fix changes a database query in the code that deals with regrading quiz attempts in Quiz admin -> Results -> Grades.

      This needs to be tested in particular on Oracle. Would be good to test all DBs (he writes, knowing that he won't be the one doing the testing).

      1. You need a quiz with several users, where each user has made several attempts.
      2. Go to Quiz admin -> Results -> Grades.
      3. Sort the table by the grade on one of the questions.
      4. In the report options, turn on the checkbox 'that are graded for each user ...'.
      5. In the quiz settings, under 'Grade', go through all 4 possible choices for 'Grading method' and reload the report each time. (You should see different data. Note that the 'that are graded for each user ...' setting does not work with Average grade.)
      6. Switch back to Highest grade, and make sure 'that are graded for each user ...' is on.
      7. Edit one of the questions in the quiz, to change which response is considered correct.
      8. Back in the report, click 'Dry run a full regrade'.
      9. Turn on the 'that have been regraded / are marked as needing regrading' option.

      At every stage, you need to check that there are no database errors, and the results are as you would expect.

      Note, there are unit tests for the key method.

      Show
      This fix changes a database query in the code that deals with regrading quiz attempts in Quiz admin -> Results -> Grades. This needs to be tested in particular on Oracle. Would be good to test all DBs (he writes, knowing that he won't be the one doing the testing). You need a quiz with several users, where each user has made several attempts. Go to Quiz admin -> Results -> Grades. Sort the table by the grade on one of the questions. In the report options, turn on the checkbox 'that are graded for each user ...'. In the quiz settings, under 'Grade', go through all 4 possible choices for 'Grading method' and reload the report each time. (You should see different data. Note that the 'that are graded for each user ...' setting does not work with Average grade.) Switch back to Highest grade, and make sure 'that are graded for each user ...' is on. Edit one of the questions in the quiz, to change which response is considered correct. Back in the report, click 'Dry run a full regrade'. Turn on the 'that have been regraded / are marked as needing regrading' option. At every stage, you need to check that there are no database errors, and the results are as you would expect. Note, there are unit tests for the key method.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      When reviewing the grades for a quiz, and modifying the report to only show attempts "that are graded for each user (Highest Grade)" results in the following Oracle error:

      Error reading from database

      Debug info: ORA-01799: a column may not be outer-joined to a subquery
      SELECT *
      FROM (SELECT 'x' FROM m_quiz_overview_regrades WHERE questionusageid IN (SELECT uniqueid FROM
      m_user u
      LEFT JOIN m_quiz_attempts quiza ON
      quiza.userid = u.id AND quiza.quiz = :o_quizid AND quiza.id = (
      SELECT MIN(qa2.id)
      FROM m_quiz_attempts qa2
      WHERE qa2.quiz = quiza.quiz AND
      qa2.userid = quiza.userid AND
      COALESCE(qa2.sumgrades, 0) = (
      SELECT MAX(COALESCE(qa3.sumgrades, 0))
      FROM m_quiz_attempts qa3
      WHERE qa3.quiz = quiza.quiz AND
      qa3.userid = quiza.userid
      )
      ) WHERE quiza.id IS NOT NULL AND quiza.preview = 0))
      WHERE rownum <= :o_oracle_num_rows
      [array (
      'o_quizid' => '1328',
      'o_oracle_num_rows' => 1,
      )]
      Stack trace:

      line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 268 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
      line 1059 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      line 1587 of /lib/dml/moodle_database.php: call to oci_native_moodle_database->get_recordset_sql()
      line 1572 of /lib/dml/moodle_database.php: call to moodle_database->record_exists_sql()
      line 542 of /mod/quiz/report/overview/report.php: call to moodle_database->record_exists_select()
      line 316 of /mod/quiz/report/overview/report.php: call to quiz_overview_report->has_regraded_questions()
      line 100 of /mod/quiz/report.php: call to quiz_overview_report->display()

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jul/14