Quiz result migration in D8 from D7

Created on 11 November 2020, about 4 years ago
Updated 24 April 2023, over 1 year ago

I am looking to migrate quiz module data from d7 to d8. Except "node quiz results" & "node quiz result answers", I have migrated all using migration script. Is there any other way to migrate complete quiz data to d8, please suggest. Thank you!!

✨ Feature request
Status

Needs review

Version

6.0

Component

Code - Other

Created by

🇮🇳India Devendra Mishra Noida

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands arjenk

    This now works for me, would be great if more people could use their testset to test the migration process.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    89 pass
  • 🇨🇦Canada bohemier Québec city, Qc

    Here is a patch with a rebase of the above MR with the current 6.x-dev

  • 🇬🇧United Kingdom somersoft

    Example JSON to use the 'plain diff' link from the issue fork to patch the quiz package in a composer.json file with the "cweagans/composer-patches" package installed.

    "patches": {
        "drupal/quiz": {
          "Quiz result migration in D8 from D7 - 3181926": "https://git.drupalcode.org/project/quiz/-/merge_requests/9.diff"
        }
    }
    
  • 🇫🇷France erwangel

    Installation with #31 and migration steps from #25 worked for me going from D7 to D10.

    However I got some errors with quiz_results_answers. I had 189 items in d7_quiz_result which were all migrated, but only 1516 items from the 1869 processed by quiz_results_answers were migrated. Perhaps the non migrated items are unfinished quizzes but there is nothing in migrate:messages that could help to debug. Also while rolling back quiz_results_answers , I got this error:

    TypeError: Drupal\quiz\Entity\QuizResultAnswer::getQuizResult(): Return value must be of type Drupal\quiz\Entity\QuizResult, null returned in Drupal\quiz\Entity\QuizResultAnswer->getQuizResult() (line 26 of /path_to_site/web/modules/contrib/quiz/src/Entity/QuizResultAnswerEntityTrait.php) #0 /path_to_site/web/modules/contrib/quiz/src/Entity/QuizResultAnswer.php(162): Drupal\quiz\Entity\QuizResultAnswer->getQuizResult()

    The other problem I got is with custom fields (I have a media_field in D7 quiz and question nodes) and usual drupal node fields like published y/n, author/date display, promoted, comments, etc or fields added by modules like metatag (essential for SEO), Any idea how to migrate these fields ? It is impossible to recreate all them as they are not accessible by "Re-use an existing field" and not available in the "Create a new field" options list. But perhaps this is not a migration problem but a limitation of the new quiz module concept. In such case, it is preferable to go the old way with quizzes and questions as nodes rather than trying to recreate a whole distinct entity.

  • Just a general comment. Is drupal quiz going to have a migration built in when updating from Drupal 7 to Drupal 8,9,10 ?

    When is Drupal quiz 6.0 series expected to get out of alpha and beta testing?

    Drupal 7 is end of life soon and it seems Drupal quiz has stalled. Is their an ETA for a production release?

  • Status changed to Needs work 6 months ago
  • 🇺🇸United States smustgrave

    Lets update for 7.0.x please

  • 🇫🇮Finland anaconda777

    What is the process of migrating custom fields? Do I need to modify the quiz_migrate module files or just the migrate files?

  • 🇬🇧United Kingdom somersoft

    @anaconda777
    If you need to migrate more fields in the fieldable content, then copy the migration configuration file, rename the file and id and add the fields. in the process mapping. The source plugin should add the registered fields to the row. For example code see Drupal\node\Plugin\migrate\source\d7\Node.
    If not then copy the used source plugin class and extend the SQL query to add the field.
    I have a module which has all the custom migration configuration files and plugins so it is a part of that.

Production build 0.71.5 2024