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

Error adding new quiz page section heading to first section (page)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a bug
    • Affects Version/s: 2.9.2
    • Fix Version/s: None
    • Component/s: Questions, Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_29_STABLE

      Description

      Clicking the "Add section header" on first quiz page, I am getting a fatal error:

      Debug info: Duplicate entry '896-1' for key 'mdl_quizsect_quifir_uix'
      INSERT INTO mdl_quiz_sections (heading,quizid,firstslot,shufflequestions) VALUES(?,?,?,?)
      [array (
      0 => 'Section heading ...',
      1 => '896',
      2 => '1',
      3 => 0,
      )]
      Error code: dmlwriteexception
      Stack trace:
      line 446 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 1164 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1210 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 985 of /mod/quiz/classes/structure.php: call to mysqli_native_moodle_database->insert_record()
      line 140 of /mod/quiz/edit.php: call to mod_quiz\structure->add_section_heading()
      

      We are using Moodle 2.9.2 which was upgraded recently from Moodle 2.7.2 (and over the years from version to version)
      So it is not a clean Moodle 2.9 install.
      And I think we have some legacy non empty mdl_quiz_sections table with rows like:

      id, quizid, firstslot, heading, shufflequestions
      "256","446","1",,"0"
      "512","914","1",,"0"
      "768","1340","1",,"0"
      ...
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                timhunt Tim Hunt
                Reporter:
                nadavkav Nadav Kavalerchik
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: