Moodle
  1. Moodle
  2. MDL-27912

Changing grading method causes database error in moodle 2.1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Testing Instructions:
      Hide

      Create a quiz, allowing multiple attempts. Set the initial grading method to highest. Finish creating and saving quiz. Login as a student and make multiple attempts. Then change the grading method first to average and then to first.

      Show
      Create a quiz, allowing multiple attempts. Set the initial grading method to highest. Finish creating and saving quiz. Login as a student and make multiple attempts. Then change the grading method first to average and then to first.
    • URL:
      qa.moodle.net
    • Affected Branches:
      MOODLE_21_STABLE
    • Rank:
      17558

      Description

      I was doing QA test MDLQA-1093 and ran into a problem when changing grading method for a quiz.

      Error reading from database

      More information about this error

      Debug info: Table 'qa.iquiza' doesn't exist

      SELECT users.userid, qg.id, qg.grade, newgrades.newgrade

      FROM (
      SELECT userid
      FROM mdl_quiz_grades qg
      WHERE quiz = ?
      UNION
      SELECT DISTINCT userid
      FROM mdl_quiz_attempts quiza2
      WHERE
      quiza2.timefinish <> 0 AND
      quiza2.preview = 0 AND
      quiza2.quiz = ?
      ) users

      LEFT JOIN mdl_quiz_grades qg ON qg.userid = users.userid AND qg.quiz = ?

      LEFT JOIN (

      SELECT quiza.userid, MAX(quiza.sumgrades) * 5 AS newgrade
      FROM mdl_quiz_attempts quiza
      JOIN (
      SELECT
      iquiza.userid,
      MIN(attempt) AS firstattempt,
      MAX(attempt) AS lastattempt

      FROM

      {quiz_attempts iquiza}

      WHERE
      iquiza.timefinish <> 0 AND
      iquiza.preview = 0 AND
      iquiza.quiz = ?

      GROUP BY iquiza.userid
      ) first_last_attempts ON first_last_attempts.userid = quiza.userid
      WHERE
      quiza.attempt = first_last_attempts.firstattempt AND
      quiza.timefinish <> 0 AND
      quiza.preview = 0 AND
      quiza.quiz = ?
      GROUP BY quiza.userid
      ) newgrades ON newgrades.userid = users.userid

      WHERE
      ABS(newgrades.newgrade - qg.grade) > 0.000005 OR
      (newgrades.newgrade IS NULL) <> (qg.grade IS NULL)
      [array (
      0 => '6',
      1 => '6',
      2 => '6',
      3 => '6',
      4 => '6',
      )]
      Stack trace:
      line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 794 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 723 of /mod/quiz/locallib.php: call to mysqli_native_moodle_database->get_records_sql()
      line 119 of /mod/quiz/lib.php: call to quiz_update_all_final_grades()
      line 327 of /course/modedit.php: call to quiz_update_instance()

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          Weird. You seem to have just filed 3 identical bugs

          Show
          Tim Hunt added a comment - Weird. You seem to have just filed 3 identical bugs

            People

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

              Dates

              • Created:
                Updated:
                Resolved: