Simon-Initiative / course-digest

Tool to produce a summary or digest of OLI course package contents
MIT License
2 stars 0 forks source link

[FEATURE] Add custom dnd migration support #59

Closed darrensiegel closed 2 years ago

darrensiegel commented 2 years ago

This PR adds support for migrating Custom Drag and Drop questions.

The main work here is:

  1. The detection of this type of question, by looking for the custom javascript tag.
  2. Conversion of the underlying mult_input question using the existing multi_input conversion code
  3. Reading and conversion of the external layout file, moving the targetArea, initiators and layoutStyles into the activity content.
  4. Detection of "non direct" image references within the layout styles, and addition of them into the media library, and replacement of their references with the full URL that the fill will exist as in Torus.

To test this out, end to end:

  1. Run Torus with the corresponding custom-dnd branch.
  2. Generate a course digest of the test course that is embedded in this repo.
  3. Ingest that digest into Torus.
  4. Verify that you can preview, deliver and edit the two custom DnD questions that appear in a page in that course.
darrensiegel commented 2 years ago

Interesting.... this works for me, and I think the dfiference might be that I'm specifying absolute paths from the command line:

Can you try again and specify absolute paths like as follows:

 node ./node_modules/ts-node/dist/bin.js src/index.ts --operation convert --inputDir /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo  --outputDir ./out --specificOrg /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/organizations/default/organization.xml  --specificOrgId migration-4sdfykby-1.0_default  --mediaUrlPrefix https://torus-media-dev.s3.amazonaws.com/media

Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/organizations/default/organization.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/welcome.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2/newe6ddd6fec8f54749a037ef13abd8df93.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/extra.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/mathml.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/entities.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/materials.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/composite.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2/assessment_with_selection.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/customdnd.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-learning_objectives/dd83841bc84045138faf6f3b7868c6dc.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-skills_model/c04c22b2337f412c8feff2c06e43cef3.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-skills_model/c04c22b2337f412c8feff2c06e43cef3.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-inline-assessment/newca1a54a0f56a4d429f5aff2c515cab08.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2/newc72f87db5a5543b5ae8582d2d4cd34a7.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-inline-assessment/weak_titration_lbd.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2-pool/complex_ion_pool.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-inline-assessment/customdnd_inline.xml
Do you want to create a zip archive? [Y/n] 
Done!
Do you want to upload media assets? [y/N] 
Skipping media upload.
rgachuhi commented 2 years ago

Interesting.... this works for me, and I think the dfiference might be that I'm specifying absolute paths from the command line:

Can you try again and specify absolute paths like as follows:

 node ./node_modules/ts-node/dist/bin.js src/index.ts --operation convert --inputDir /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo  --outputDir ./out --specificOrg /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/organizations/default/organization.xml  --specificOrgId migration-4sdfykby-1.0_default  --mediaUrlPrefix https://torus-media-dev.s3.amazonaws.com/media

Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/organizations/default/organization.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/welcome.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2/newe6ddd6fec8f54749a037ef13abd8df93.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/extra.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/mathml.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/entities.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/materials.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/composite.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2/assessment_with_selection.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-workbook_page/customdnd.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-learning_objectives/dd83841bc84045138faf6f3b7868c6dc.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-skills_model/c04c22b2337f412c8feff2c06e43cef3.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-skills_model/c04c22b2337f412c8feff2c06e43cef3.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-inline-assessment/newca1a54a0f56a4d429f5aff2c515cab08.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2/newc72f87db5a5543b5ae8582d2d4cd34a7.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-inline-assessment/weak_titration_lbd.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-assessment2-pool/complex_ion_pool.xml
Converting:  /Users/darrensiegel/dev/course-digest/test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-inline-assessment/customdnd_inline.xml
Do you want to create a zip archive? [Y/n] 
Done!
Do you want to upload media assets? [y/N] 
Skipping media upload.

Yep, works when I use fully qualified file paths

eliknebel commented 2 years ago

I ran into the same issue as Raphael, where the webcontent image could not be found when using a relative path. Using an absolute path fixes it