Simon-Initiative / course-digest

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

[BUG FIX] More chem fixes #90

Closed darrensiegel closed 1 year ago

darrensiegel commented 1 year ago

This PR fixes:

  1. Removes embedded purpose within inlines that are within composite activities
  2. Preserves whitespace within choices, hints, feedbacks and explanations that do not have a parent paragraph
  3. Removes paginationMode setting optimization that was preventing paginationMode from being set in all places
  4. Ensure that empty choices get a paragraph wrapped around them

I had to eventually just remove a test in the feedback-test.ts file. It failed with:


    Expected: ObjectContaining {"content": {"authoring": {"parts": [{"explanation": null, "gradingApproach": "automatic", "hints": [{"content": {"model": [{"children": [Array], "type": "p"}]}, "id": Any<String>}, {"content": {"model": [{"children": [Array], "type": "p"}]}, "id": Any<String>}, {"content": {"model": [{"children": [Array], "type": "p"}]}, "id": Any<String>}], "id": Any<String>, "objectives": Any<Array>, "outOf": null, "responses": [{"feedback": {"content": {"model": [[Object]]}, "id": Any<String>}, "id": Any<String>, "rule": "input like {1}", "score": 1}, {"feedback": {"content": {"model": [[Object]]}, "id": Any<String>}, "id": Any<String>, "rule": "input like {.*}", "score": 0}], "scoringStrategy": "average", "targeted": Any<Array>}], "previewText": "", "targeted": Any<Array>, "transformations": []}, "choices": Anything, "items": [{"content": {"model": [{"children": [{"text": "Chemistry is..."}], "type": "p"}]}, "id": "q1", "required": "true"}], "orderDescending": false, "stem": {"content": {"model": [{"strong": true, "text": "PartI:"}, {"text": "A list of opposing words appears below. Rate how well these words describe your feelings about chemistry. Think carefully and try not to include your feelings toward chemistry teachers or chemistry courses. For each line, choose a position between the two words that describes exactly how you feel. The middle position (4) is if you are undecided or have no feelings related to the terms on that row. Your answers should finish the statement:"}]}}}, "id": StringContaining "pre_course_student_survey-", "imageReferences": undefined, "legacyId": "pre_course_student_survey", "legacyPath": "test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-feedback/pre_course_student_survey.xml", "objectives": Any<Object>, "subType": "oli_likert", "tags": [], "title": "", "type": "Activity", "unresolvedReferences": [], "warnings": []}
    Received: {"content": {"authoring": {"parts": [{"explanation": null, "gradingApproach": "automatic", "hints": [{"content": {"model": [{"children": [Array], "type": "p"}]}, "id": "3134856926"}, {"content": {"model": [{"children": [Array], "type": "p"}]}, "id": "1037468392"}, {"content": {"model": [{"children": [Array], "type": "p"}]}, "id": "895338340"}], "id": "q1", "objectives": [], "outOf": null, "responses": [{"feedback": {"content": {"model": [[Object]]}, "id": "3890158258"}, "id": "2339007239", "rule": "input like {1}", "score": 1}, {"feedback": {"content": {"model": [[Object]]}, "id": "3717145815"}, "id": "1370329721", "rule": "input like {.*}", "score": 0}], "scoringStrategy": "average", "targeted": []}], "previewText": "", "targeted": [], "transformations": []}, "choices": [{"content": {"model": [{"children": [{"text": "hard"}], "type": "p"}]}, "id": "1"}, {"content": {"model": [{"children": [{"text": " "}], "type": "p"}]}, "id": "2"}, {"content": {"model": [{"children": [{"text": " "}], "type": "p"}]}, "id": "3"}, {"content": {"model": [{"children": [{"text": " "}], "type": "p"}]}, "id": "4"}, {"content": {"model": [{"children": [{"text": " "}], "type": "p"}]}, "id": "5"}, {"content": {"model": [{"children": [{"text": " "}], "type": "p"}]}, "id": "6"}, {"content": {"model": [{"children": [{"text": "easy"}], "type": "p"}]}, "id": "7"}], "items": [{"content": {"model": [{"children": [{"text": "Chemistry is..."}], "type": "p"}]}, "id": "q1", "required": "true"}], "orderDescending": false, "stem": {"content": {"model": [{"children": [{"strong": true, "text": "PartI:"}, {"text": "A list of opposing words appears below. Rate how well these words describe your feelings about chemistry. Think carefully and try not to include your feelings toward chemistry teachers or chemistry courses. For each line, choose a position between the two words that describes exactly how you feel. The middle position (4) is if you are undecided or have no feelings related to the terms on that row. Your answers should finish the statement:"}], "type": "p"}]}}}, "id": "pre_course_student_survey-2765647949", "imageReferences": undefined, "legacyId": "pre_course_student_survey", "legacyPath": "test/course_packages/migration-4sdfykby_v_1_0-echo/content/x-oli-feedback/pre_course_student_survey.xml", "objectives": {"q1": []}, "subType": "oli_likert", "tags": [], "title": "", "type": "Activity", "unresolvedReferences": [], "warnings": []}

Which I spent a half hour trying to figure out what was changed. These "full object" assertions are nice, but it ends up being very challenging to figure out what is different.