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

Error: mdb->get_record() found more than one record! When restoring question hints

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.4.6, 4.5.2, 5.0
    • Questions
    • MOODLE_404_STABLE, MOODLE_405_STABLE, MOODLE_500_STABLE

      Steps to reproduce:

      1. Create a new course.
      2. In the course's shared question bank, create a shortanswer question. In the "Multiple tries" section of the form, create 2 hints with the exact same text "Hint".
      3. Create a quiz on the course, and add the shortanswer question to the quiz.
      4. Create a backup of the quiz, trigger the cron to run the backup process.
      5. Restore the quiz to the same course, trigger the cron to run the restore process and observe the output.
        • Expected: The restore is performed without error.
        • Actual: The output will contain: "Error: mdb->get_record() found more than one record!"

      This is because restore_create_categories_and_questions::process_question_hint() matches questions in the backup with questions in the database based on whether the question ID and text are identical. Since it is possible to create multiple hints on a question with identical (or even empty) text, it is possible that this query will match multiple records.

      Its not immediately clear what we should do about this. Creating multiple identical hints is a valid use case, so we may simple want to ignore multiple records here to remove the debugging message. This will result in multiple mappings being created to the same existing hint ID, but since we're not actually creating new hints, it might not matter? The code to create the mapping even says "// Create mapping (I'm not sure if this is really needed?)".

            Unassigned Unassigned
            marxjohnson Mark Johnson
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

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