Search in sources :

Example 11 with ExtendedTextInteraction

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project OpenOLAT by OpenOLAT.

the class AssessmentItemBuilderTest method buildAssessmentItem_essay.

@Test
public void buildAssessmentItem_essay() throws IOException, URISyntaxException {
    QtiSerializer qtiSerializer = new QtiSerializer(new JqtiExtensionManager());
    EssayAssessmentItemBuilder itemBuilder = new EssayAssessmentItemBuilder("Essay", qtiSerializer);
    if (build.booleanValue()) {
        itemBuilder.build();
    }
    AssessmentItem assessmentItem = itemBuilder.getAssessmentItem();
    ItemValidationResult itemResult = serializeAndReload(assessmentItem);
    AssessmentItem reloadedItem = itemResult.getResolvedAssessmentItem().getItemLookup().extractIfSuccessful();
    List<Interaction> interactions = reloadedItem.getItemBody().findInteractions();
    Assert.assertNotNull(interactions);
    Assert.assertEquals(1, interactions.size());
    Assert.assertTrue(interactions.get(0) instanceof ExtendedTextInteraction);
}
Also used : JqtiExtensionManager(uk.ac.ed.ph.jqtiplus.JqtiExtensionManager) QtiSerializer(uk.ac.ed.ph.jqtiplus.serialization.QtiSerializer) TextEntryInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.TextEntryInteraction) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) HotspotInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.HotspotInteraction) Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) ChoiceInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction) MatchInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.MatchInteraction) EssayAssessmentItemBuilder(org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) ItemValidationResult(uk.ac.ed.ph.jqtiplus.validation.ItemValidationResult) Test(org.junit.Test)

Example 12 with ExtendedTextInteraction

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project OpenOLAT by OpenOLAT.

the class AssessmentItemFactory method appendExtendedTextInteraction.

public static ExtendedTextInteraction appendExtendedTextInteraction(ItemBody itemBody, Identifier responseDeclarationId) {
    ExtendedTextInteraction textInteraction = new ExtendedTextInteraction(itemBody);
    textInteraction.setResponseIdentifier(responseDeclarationId);
    itemBody.getBlocks().add(textInteraction);
    return textInteraction;
}
Also used : ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction)

Example 13 with ExtendedTextInteraction

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project openolat by klemens.

the class AssessmentTestHelper method needManualCorrection.

public static boolean needManualCorrection(AssessmentItemRef itemRef, ResolvedAssessmentTest resolvedAssessmentTest) {
    ResolvedAssessmentItem resolvedAssessmentItem = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
    if (resolvedAssessmentItem != null && resolvedAssessmentItem.getItemLookup() != null && resolvedAssessmentItem.getItemLookup().getRootNodeHolder() != null) {
        AssessmentItem assessmentItem = resolvedAssessmentItem.getItemLookup().getRootNodeHolder().getRootNode();
        List<Interaction> interactions = assessmentItem.getItemBody().findInteractions();
        for (Interaction interaction : interactions) {
            if (interaction instanceof UploadInteraction || interaction instanceof DrawingInteraction || interaction instanceof ExtendedTextInteraction) {
                return true;
            }
        }
    }
    return false;
}
Also used : UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) UploadInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction) Interaction(uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) DrawingInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction)

Example 14 with ExtendedTextInteraction

use of uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction in project openolat by klemens.

the class EssayAssessmentItemBuilder method getQuestionBlocks.

/**
 * @return A copy of the list of blocks which make the question.
 * 		The list is a copy and modification will not be persisted.
 */
public List<Block> getQuestionBlocks() {
    List<Block> blocks = assessmentItem.getItemBody().getBlocks();
    List<Block> questionBlocks = new ArrayList<>(blocks.size());
    for (Block block : blocks) {
        if (block instanceof ExtendedTextInteraction) {
            break;
        } else {
            questionBlocks.add(block);
        }
    }
    return questionBlocks;
}
Also used : ArrayList(java.util.ArrayList) Block(uk.ac.ed.ph.jqtiplus.node.content.basic.Block) ExtendedTextInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction) AssessmentItemFactory.appendExtendedTextInteraction(org.olat.ims.qti21.model.xml.AssessmentItemFactory.appendExtendedTextInteraction)

Aggregations

ExtendedTextInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ExtendedTextInteraction)14 Interaction (uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction)8 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)6 DrawingInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.DrawingInteraction)6 UploadInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.UploadInteraction)6 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)6 ArrayList (java.util.ArrayList)4 AssessmentItemFactory.appendExtendedTextInteraction (org.olat.ims.qti21.model.xml.AssessmentItemFactory.appendExtendedTextInteraction)4 Block (uk.ac.ed.ph.jqtiplus.node.content.basic.Block)4 File (java.io.File)2 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 Test (org.junit.Test)2 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)2 StringOutput (org.olat.core.gui.render.StringOutput)2 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 EssayAssessmentItemBuilder (org.olat.ims.qti21.model.xml.interactions.EssayAssessmentItemBuilder)2 InteractionResultFormItem (org.olat.ims.qti21.ui.components.InteractionResultFormItem)2 JqtiExtensionManager (uk.ac.ed.ph.jqtiplus.JqtiExtensionManager)2