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

Question upgrade throws errors, may cause dataloss(?)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 4.0
    • Questions, Quiz
    • MOODLE_400_STABLE
    • MDL-74268-master
    • Hide
      1. Setup a Moodle 3.11 or below site
      2. In a course, setup a question bank with some questions in it, setting some to have the tag mytag
      3. Create a quiz
      4. Add 1 or more random questions to the quiz that draw from the category you created, and add a tag filter for the tag mytag
      5. Now upgrade the site to Moodle 4.0
      6. Confirm there are no errors during upgrade
      7. In mdl_question_set_references, you can inspect, and there should be some records where the field filtercondition contains the item tags, which will be an array that should have values something like {3,mytag}
      Show
      Setup a Moodle 3.11 or below site In a course, setup a question bank with some questions in it, setting some to have the tag mytag Create a quiz Add 1 or more random questions to the quiz that draw from the category you created, and add a tag filter for the tag mytag Now upgrade the site to Moodle 4.0 Confirm there are no errors during upgrade In mdl_question_set_references , you can inspect, and there should be some records where the field filtercondition contains the item tags , which will be an array that should have values something like { 3,mytag }

      When doing a test upgrade, during the call to upgrade_migrate_question_table() in upgradelib.php, we saw hundreds of the following error:

      Notice: Undefined property: stdClass::$name in /var/www/other/major/lib/db/upgradelib.php on line 1363
      

      The upgrade step has this code in it:

      $tags = $DB->get_records('quiz_slot_tags', ['slotid' => $quizslot->id]);
      $tagstrings = [];
      foreach ($tags as $tag) {
          $tagstrings [] = "{$tag->id},{$tag->name}";
      }
      

      But the problem is that the column name is tagname, not name. So I'm pretty sure it should be:

      $tagstrings [] = "{$tag->id},{$tag->tagname}";
      

      I'm not sure this is actual dataloss, since I assume the tagname is just duplicated from the tags table, but I'm not sure why it is here, so I might be wrong on that.

            emerrill Eric Merrill
            emerrill Eric Merrill
            Tim Hunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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