Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5261

Flashcard error when question categories exist in bad context



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.6.4
    • Fix Version/s: None
    • Component/s: Module: Flashcard
    • Labels:
    • Plugin Version:
    • Affected Branches:


      If you have a site that has question categories that are in an incorrect context (seen by running a health report), you will receive the following error when trying to add a flashcard module to a course;

      More information about this error
      Debug info: SELECT * FROM {context} WHERE id = ?
      [array (
      0 => '16310',
      Error code: invalidrecord
      Stack trace:
          line 1403 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
          line 1379 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 5349 of /lib/accesslib.php: call to moodle_database->get_record()
          line 1377 of /lib/questionlib.php: call to context::instance_by_id()
          line 66 of /mod/flashcard/mod_form.php: call to question_has_capability_on()
          line ? of unknownfile: call to drop_questions()
          line 69 of /mod/flashcard/mod_form.php: call to array_filter()
          line 191 of /lib/formslib.php: call to mod_flashcard_mod_form->definition()
          line 86 of /course/moodleform_mod.php: call to moodleform->moodleform()
          line 256 of /course/modedit.php: call to moodleform_mod->moodleform_mod()

      If you run the health report and the categories have questions in them it is difficult to resolve. As a work around I have created a course and moved those categories into it's context, so they are in a valid context and the error goes away. However, I am wondering if it is possible that the module could just skip over these categories instead of throwing an error and not being usable?


          Issue Links



              • Votes:
                4 Vote for this issue
                5 Start watching this issue


                • Created: