Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: QTI support is improved #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

myhailo-chernyshov-rg
Copy link

@myhailo-chernyshov-rg myhailo-chernyshov-rg commented Nov 20, 2024

Description

During the cc2olx converter usage with correct Common Cartridge course .imscc dumps some problems with CC XML processing were encountered. It caused by handling of special cases by the converter while the actual CC XML can be much more complicated. This PR is intended to solve the encountered problems.
Also, it's found out that cc2olx completely ignores the fact that both OeX "Text Problem" and CC "Fill in the blank" support regexps, so their support is added.

Steps to reproduce

Untitled quiz item

  1. Update your Common Cartridge course .imscc dump (or use the attached one
    untitled_quiz_item_dump.imscc.zip but remove .zip extention leaving .imscc): ensure you have the assessment with item that doesn't have title attribute.
    For example,
    ...
    <assessment ident="i13874147-14c5-4849-93a7-7af746fdd86d" title="Capital Cities of the World">
        ...
        <section ident="root_section">
            <item ident="ic8308415-91d6-4655-a4ba-99db7d0c68b3">
                ...
            </item>
        </section>
        ...
    </assessment>
    ...
  2. Run the cc2olx script:
    cc2olx -i path/to/imscc
  3. See a KeyError message.

Section with not root_section identifier

  1. Update your Common Cartridge course .imscc dump (or use the attached one
    section_with_not_root_section_identifier.imscc.zip but remove .zip extention leaving .imscc): ensure you have the assessment with section which ident attribute value isn't root_section.
    For example,
    ...
    <assessment ident="i13874147-14c5-4849-93a7-7af746fdd86d" title="Capital Cities of the World">
        ...
        <section ident="id747a627-25dd-4289-b850-98b134316b50">
            ...
        </section>
        ...
    </assessment>
    ...
  2. Run the cc2olx script:
    cc2olx -i path/to/imscc
  3. Explore the output OLX (or use the generated archive for course import in edX) and ensure that the problems from this section are not presented in the course.

respcondition without continue attribute

  1. Update your Common Cartridge course .imscc dump (or use the attached one respcondition_without_continue_attribute.imscc.zip but remove .zip extention leaving .imscc): ensure you have the assessment with respcondition without continue attribute.
    For example,
    ...
    <assessment ident="i13874147-14c5-4849-93a7-7af746fdd86d" title="Capital Cities of the World">
        ...
        <item ident="ic8308415-91d6-4655-a4ba-99db7d0c68b3" title="The capital city of Australia">
            ...
            <resprocessing>
                ...
                <respcondition>
                    <conditionvar>
                        <varequal respident="i44f42e88-8f56-4a80-9998-567aaacd6c53">i8a6371a5-2741-408e-9f01-8ecec5457f4f</varequal>
                    </conditionvar>
                    <setvar action="Set" varname="SCORE">100</setvar>
                </respcondition>
                ...
            </resprocessing>
            ...
        </item>
        ...
    </assessment>
    ...
  2. Run the cc2olx script:
    cc2olx -i path/to/imscc
  3. See a KeyError message.

material is not direct child of solutionmaterial

  1. Update your Common Cartridge course .imscc dump (or use the attached one material_is_not_direct_child_of_solutionmaterial.zip but remove .zip extention leaving .imscc): ensure you have the assessment with itemfeedback, itemfeedback has solution child, solution has solutionmaterial, material is not a direct child of solutionmaterial: flow_mat is a solutionmaterial child, material is a flow_mat child.
    For example,
    ...
    <assessment ident="i13874147-14c5-4849-93a7-7af746fdd86d" title="Capital Cities of the World">
        ...
        <item ident="ic8308415-91d6-4655-a4ba-99db7d0c68b3" title="The capital city of Australia">
            ...
            <itemfeedback ident="solution">
                <solution>
                    <solutionmaterial>
                        <flow_mat>
                            <material>
                                <mattext texttype="text/html"></mattext>
                            </material>
                        </flow_mat>
                    </solutionmaterial>
                </solution>
            </itemfeedback>
            <itemfeedback ident="general_fb">
                <flow_mat>
                    <material>
                        <mattext texttype="text/html"></mattext>
                    </material>
                </flow_mat>
            </itemfeedback>
            ...
        </item>
        ...
    </assessment>
    ...
  2. Run the cc2olx script:
    cc2olx -i path/to/imscc
  3. See a AttributeError message.

Fill in the blank with regexp

  1. Update your Common Cartridge course .imscc dump (or use the attached one fib_with_regexp.imscc.zip but remove .zip extention leaving .imscc): ensure you have the Fill in the blank assessment with resprocessing that contains respcondition with varsubstring in conditionvar.
    For example,
    ...
    <assessment ident="i13874147-14c5-4849-93a7-7af746fdd86d" title="Capital Cities of the World">
        ...
        <item ident="ic8308415-91d6-4655-a4ba-99db7d0c68b3" title="The largest city in Switzerland">
            ...
            <resprocessing>
                <outcomes>
                    <decvar minvalue="0" maxvalue="100" varname="SCORE" vartype="Decimal" />
                </outcomes>
                <respcondition continue="No">
                    <conditionvar>
                        <varsubstring respident="32693">Z[uü]rich</varsubstring>
                    </conditionvar>
                    <setvar action="Set" varname="SCORE">100</setvar>
                </respcondition>
                <respcondition continue="Yes">
                    <conditionvar>
                        <other />
                    </conditionvar>
                    <setvar action="Set" varname="SCORE">0</setvar>
                </respcondition>
            </resprocessing>
            ...
        </item>
        ...
    </assessment>
    ...
  2. Run the cc2olx script:
    cc2olx -i path/to/imscc
  3. See a IndexError message.

Deadline

"None"

src/cc2olx/qti.py Show resolved Hide resolved
@@ -321,7 +334,7 @@ def parse_qti(self):
root = tree.getroot()

# qti xml can contain multiple problems represented by <item/> elements

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still relevant?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we changed the code to consider all sections instead of just one with root_section identifier. Comment doesn't relate to identifiers, so nothing changed related to the comment, we still can have multiple <item/> elements.

src/cc2olx/qti.py Show resolved Hide resolved
src/cc2olx/qti.py Show resolved Hide resolved
src/cc2olx/qti.py Outdated Show resolved Hide resolved
@myhailo-chernyshov-rg myhailo-chernyshov-rg force-pushed the myhailochernyshov/qti-support-improving branch from 476cdd3 to 13dbbc7 Compare November 22, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants