Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Quiz
    • Labels:
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      16822

      Description

      See http://moodle.org/mod/forum/discuss.php?d=171108

      Error writing to database

      More information about this error
      Debug info: Out of range value adjusted for column 'credit' at row 1
      INSERT INTO mdl_quiz_question_response_stats (subqid,response,aid,credit,questionid,rcount,quizstatisticsid) VALUES(?,?,?,?,?,?,?)
      [array (
      0 => 291697,
      1 => 'A mixture',
      2 => 710911,
      3 => '-0.5000000',
      4 => '291697',
      5 => 1,
      6 => 24,
      )]
      Stack trace:

      • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 874 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 916 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      • line 615 of /mod/quiz/report/statistics/report.php: call to mysqli_native_moodle_database->insert_record()
      • line 97 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->quiz_questions_stats()
      • line 90 of /mod/quiz/report.php: call to quiz_statistics_report->display()

        Activity

        Hide
        Tim Hunt added a comment -

        The problem is that the credit column is specified as UNSIGNED, which is silly. (And only MySQL pays attention to that anyway.) I will change the DB definition to fix this.

        Show
        Tim Hunt added a comment - The problem is that the credit column is specified as UNSIGNED, which is silly. (And only MySQL pays attention to that anyway.) I will change the DB definition to fix this.
        Hide
        Tim Hunt added a comment -

        I think that https://github.com/timhunt/moodle/compare/master...MDL-26848 is the correct fix. Needs to be tested on MySQL before I do a pull request.

        Show
        Tim Hunt added a comment - I think that https://github.com/timhunt/moodle/compare/master...MDL-26848 is the correct fix. Needs to be tested on MySQL before I do a pull request.
        Hide
        Tim Hunt added a comment -

        Oops, there was a problem with the first version of the patch. Thanks to Anthony Borrow for catching it. I just rewrote it (naughtily by using git commit --amend) so the link for the fix is the same.

        Show
        Tim Hunt added a comment - Oops, there was a problem with the first version of the patch. Thanks to Anthony Borrow for catching it. I just rewrote it (naughtily by using git commit --amend) so the link for the fix is the same.
        Hide
        Tim Hunt added a comment -

        Anthony confirms that this works for him: http://moodle.org/mod/cvsadmin/view.php?conversationid=7026

        To test:

        Create a quiz with a few questions, including at least one mulitple-choice multiple-response question where the wrong choices have a negative grade.

        Then do several attempts as different students.

        Then visit the statistics report.

        Show
        Tim Hunt added a comment - Anthony confirms that this works for him: http://moodle.org/mod/cvsadmin/view.php?conversationid=7026 To test: Create a quiz with a few questions, including at least one mulitple-choice multiple-response question where the wrong choices have a negative grade. Then do several attempts as different students. Then visit the statistics report.
        Hide
        Helen Foster added a comment -

        Thanks Tim

        Show
        Helen Foster added a comment - Thanks Tim

          People

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

            Dates

            • Created:
              Updated:
              Resolved: