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

Changing grading method causes database error in moodle 2.1

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.1
    • 2.1
    • Quiz
    • MOODLE_21_STABLE
    • MOODLE_21_STABLE
    • qa.moodle.net
    • Hide

      Create a quiz, allowing multiple attempts, with grading method set to maximum grade.
      Login as a student and make multiple attempts.
      Then change the grading method to first or last attempt. (Ideally tr
      Verify that the grades are recomputed correctly, in particular that you don't get a fatal error.

      Ideally try changing between all the grading methods and verify the scores after each change.

      Show
      Create a quiz, allowing multiple attempts, with grading method set to maximum grade. Login as a student and make multiple attempts. Then change the grading method to first or last attempt. (Ideally tr Verify that the grades are recomputed correctly, in particular that you don't get a fatal error. Ideally try changing between all the grading methods and verify the scores after each change.

    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()

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              rsturley Steve Turley
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tim Hunt, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Kevin Percy, Laurent David, Mathew May, Mihail Geshoski, Raquel Ortega, Sabina Abellan, Sander Bangma, Sara Arjona (@sarjona), Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                1/Jul/11