Search in sources :

Example 1 with OrderInteraction

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

the class OrderInteractionArchive method writeHeader1.

@Override
public int writeHeader1(AssessmentItem item, Interaction interaction, int itemNumber, int interactionNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    if (interactionNumber == 0) {
        String header = item.getTitle();
        dataRow.addCell(col, header, workbook.getStyles().getHeaderStyle());
    }
    OrderInteraction orderInteraction = (OrderInteraction) interaction;
    int numOfChoices = orderInteraction.getSimpleChoices().size();
    col += Math.max(1, numOfChoices);
    return col;
}
Also used : OrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction)

Example 2 with OrderInteraction

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

the class OrderInteractionArchive method writeHeader2.

@Override
public int writeHeader2(AssessmentItem item, Interaction interaction, int itemNumber, int interactionNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    OrderInteraction orderInteraction = (OrderInteraction) interaction;
    int numOfChoices = orderInteraction.getSimpleChoices().size();
    if (numOfChoices > 0) {
        for (int i = 0; i < numOfChoices; i++) {
            String header = (itemNumber + 1) + "_O" + (i + 1);
            dataRow.addCell(col++, header, workbook.getStyles().getHeaderStyle());
        }
    } else {
        col++;
    }
    return col;
}
Also used : OrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction)

Example 3 with OrderInteraction

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

the class OrderInteractionArchive method writeInteractionData.

@Override
public int writeInteractionData(AssessmentItem item, AssessmentResponse response, Interaction interaction, int itemNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    OrderInteraction orderInteraction = (OrderInteraction) interaction;
    List<SimpleChoice> choices = orderInteraction.getSimpleChoices();
    if (choices.size() > 0) {
        String stringuifiedResponse = response == null ? null : response.getStringuifiedResponse();
        List<String> responses = CorrectResponsesUtil.parseResponses(stringuifiedResponse);
        List<Identifier> correctAnswers = CorrectResponsesUtil.getCorrectOrderedIdentifierResponses(item, interaction);
        for (int i = 0; i < choices.size(); i++) {
            String currentResponse = null;
            String currentResponseText = null;
            if (responses.size() > i) {
                currentResponse = currentResponseText = responses.get(i);
                SimpleChoice selectedChoice = orderInteraction.getSimpleChoice(Identifier.assumedLegal(currentResponse));
                if (selectedChoice != null) {
                    currentResponseText = getContent(selectedChoice);
                }
            }
            String correctAnswer = null;
            if (correctAnswers.size() > i) {
                correctAnswer = correctAnswers.get(i).toString();
            }
            if (correctAnswer != null && correctAnswer.equals(currentResponse)) {
                dataRow.addCell(col++, currentResponseText, workbook.getStyles().getCorrectStyle());
            } else {
                dataRow.addCell(col++, currentResponseText, null);
            }
        }
    } else {
        col++;
    }
    return col;
}
Also used : SimpleChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) OrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction)

Example 4 with OrderInteraction

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

the class OrderInteractionArchive method writeInteractionData.

@Override
public int writeInteractionData(AssessmentItem item, AssessmentResponse response, Interaction interaction, int itemNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    OrderInteraction orderInteraction = (OrderInteraction) interaction;
    List<SimpleChoice> choices = orderInteraction.getSimpleChoices();
    if (choices.size() > 0) {
        String stringuifiedResponse = response == null ? null : response.getStringuifiedResponse();
        List<String> responses = CorrectResponsesUtil.parseResponses(stringuifiedResponse);
        List<Identifier> correctAnswers = CorrectResponsesUtil.getCorrectOrderedIdentifierResponses(item, interaction);
        for (int i = 0; i < choices.size(); i++) {
            String currentResponse = null;
            String currentResponseText = null;
            if (responses.size() > i) {
                currentResponse = currentResponseText = responses.get(i);
                SimpleChoice selectedChoice = orderInteraction.getSimpleChoice(Identifier.assumedLegal(currentResponse));
                if (selectedChoice != null) {
                    currentResponseText = getContent(selectedChoice);
                }
            }
            String correctAnswer = null;
            if (correctAnswers.size() > i) {
                correctAnswer = correctAnswers.get(i).toString();
            }
            if (correctAnswer != null && correctAnswer.equals(currentResponse)) {
                dataRow.addCell(col++, currentResponseText, workbook.getStyles().getCorrectStyle());
            } else {
                dataRow.addCell(col++, currentResponseText, null);
            }
        }
    } else {
        col++;
    }
    return col;
}
Also used : SimpleChoice(uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) OrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction)

Example 5 with OrderInteraction

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

the class OrderInteractionArchive method writeHeader1.

@Override
public int writeHeader1(AssessmentItem item, Interaction interaction, int itemNumber, int interactionNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    if (interactionNumber == 0) {
        String header = item.getTitle();
        dataRow.addCell(col, header, workbook.getStyles().getHeaderStyle());
    }
    OrderInteraction orderInteraction = (OrderInteraction) interaction;
    int numOfChoices = orderInteraction.getSimpleChoices().size();
    col += Math.max(1, numOfChoices);
    return col;
}
Also used : OrderInteraction(uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction)

Aggregations

OrderInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.OrderInteraction)8 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 FormJSHelper (org.olat.core.gui.components.form.flexible.impl.FormJSHelper)2 StringOutput (org.olat.core.gui.render.StringOutput)2 URLBuilder (org.olat.core.gui.render.URLBuilder)2 VelocityRenderDecorator (org.olat.core.gui.render.velocity.VelocityRenderDecorator)2 Translator (org.olat.core.gui.translator.Translator)2 Settings (org.olat.core.helpers.Settings)2 OLog (org.olat.core.logging.OLog)2 Tracing (org.olat.core.logging.Tracing)2 StringHelper (org.olat.core.util.StringHelper)2 AssessmentTestSession (org.olat.ims.qti21.AssessmentTestSession)2 CandidateSessionContext (org.olat.ims.qti21.ui.CandidateSessionContext)2 AssessmentRenderFunctions.renderValue (org.olat.ims.qti21.ui.components.AssessmentRenderFunctions.renderValue)2