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

error/moodle/dmlreadexception when grade weight is changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.3
    • 2.1.2, 2.2
    • Quiz
    • Microsoft Windows 2008 R2, MS SQL 2005, PHP 5.3.6, IIS 7
    • Microsoft SQL
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE
    • Hide

      1. Create a quiz one essay question.
      2. Attempt the quiz twice as a student.
      3. As teacher, grade the first attempt, but not the second attempt.
      4. Try switching the grading method from first attempt to second attempt, and back.
      5. Verify that the student's overall best grade (in the gradebook, and on the quiz view page when logged in as the student) toggles between NULL and the grade you assigned when manually grading.

      Show
      1. Create a quiz one essay question. 2. Attempt the quiz twice as a student. 3. As teacher, grade the first attempt, but not the second attempt. 4. Try switching the grading method from first attempt to second attempt, and back. 5. Verify that the student's overall best grade (in the gradebook, and on the quiz view page when logged in as the student) toggles between NULL and the grade you assigned when manually grading.

      When editing a simple quiz to change the grade weight I get the error "error/moodle/dmlreadexception" when saving. The new grade is saved.
      Debugging produces:

      Debug info: SQLState: 42000<br>
      Error Code: 102<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '<'.<br>

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

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

      LEFT JOIN mdl_quiz_grades qg ON qg.userid = users.userid AND qg.quiz = '376'

      LEFT JOIN (

      SELECT quiza.userid, MAX(quiza.sumgrades) * 1.1111111111111 AS newgrade
      FROM mdl_quiz_attempts quiza

      WHERE

      quiza.timefinish <> 0 AND
      quiza.preview = 0 AND
      quiza.quiz = '376'
      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 => '376',
      1 => '376',
      2 => '376',
      3 => '376',
      )]

      Stack trace: •line 394 of \lib\dml\moodle_database.php: dml_read_exception thrown
      •line 252 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
      •line 368 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
      •line 773 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
      •line 807 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql()
      •line 697 of \mod\quiz\locallib.php: call to sqlsrv_native_moodle_database->get_records_sql()
      •line 380 of \mod\quiz\edit.php: call to quiz_update_all_final_grades()

            timhunt Tim Hunt
            thordur Thordur Hauksson
            Aparup Banerjee Aparup Banerjee
            Jason Fowler Jason Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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