Search in sources :

Example 31 with Identifier

use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.

the class AlienItemAnalyzer method checkFeedback.

private void checkFeedback(Report report) {
    if (item.getModalFeedbacks() != null && item.getModalFeedbacks().size() > 0) {
        Set<Identifier> outcomeIdentifiers = new HashSet<>();
        List<ModalFeedback> feedbacks = item.getModalFeedbacks();
        for (ModalFeedback feedback : feedbacks) {
            if (feedback.getOutcomeIdentifier() != null) {
                outcomeIdentifiers.add(feedback.getOutcomeIdentifier());
            }
        }
        if (outcomeIdentifiers.size() == 1) {
            if (outcomeIdentifiers.iterator().next().equals(QTI21Constants.FEEDBACKMODAL_IDENTIFIER)) {
                checkFeedbackModalResponseProcessing(report);
            } else {
                report.addWarning(ReportWarningEnum.alienFeedbacks);
            }
        } else {
            // Onyx and OpenOLAT only use one outcome identifier for the feedbacks
            // Taotesting use several different identifiers. And we don't
            // understand feedbacks without outcome identifiers
            report.addWarning(ReportWarningEnum.alienFeedbacks);
        }
    }
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) HashSet(java.util.HashSet)

Example 32 with Identifier

use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.

the class AssessmentItemBuilder method appendAdditionalFeedback.

protected void appendAdditionalFeedback(ModalFeedbackBuilder feedback, List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
    Identifier feedbackIdentifier = feedback.getIdentifier();
    ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, feedbackIdentifier, feedback.getTitle(), feedback.getText());
    modalFeedbacks.add(modalFeedback);
    Cardinality cardinality = null;
    Identifier responseIdentifier = null;
    if (this instanceof ResponseIdentifierForFeedback) {
        responseIdentifier = ((ResponseIdentifierForFeedback) this).getResponseIdentifier();
        cardinality = assessmentItem.getResponseDeclaration(responseIdentifier).getCardinality();
    }
    ResponseCondition feedbackCondition = AssessmentItemFactory.createModalFeedbackRuleWithConditions(assessmentItem.getResponseProcessing(), feedbackIdentifier, responseIdentifier, cardinality, feedback.getFeedbackConditons());
    responseRules.add(feedbackCondition);
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) Cardinality(uk.ac.ed.ph.jqtiplus.value.Cardinality) ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) ResponseCondition(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)

Example 33 with Identifier

use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.

the class AbstractChoiceInteractionArchive method writeInteractionData.

@Override
public int writeInteractionData(AssessmentItem item, AssessmentResponse response, Interaction interaction, int itemNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    String stringuifiedResponses = response == null ? null : response.getStringuifiedResponse();
    List<Identifier> correctAnswers = CorrectResponsesUtil.getCorrectIdentifierResponses(item, interaction);
    List<? extends Choice> choices = getChoices(interaction);
    if (StringHelper.containsNonWhitespace(stringuifiedResponses)) {
        for (int i = 0; i < choices.size(); i++) {
            Identifier choiceIdentifier = choices.get(i).getIdentifier();
            if (stringuifiedResponses.contains("[" + choiceIdentifier + "]")) {
                if (correctAnswers.contains(choiceIdentifier)) {
                    // the checked answer is correct
                    dataRow.addCell(col++, "x", workbook.getStyles().getCorrectStyle());
                } else {
                    dataRow.addCell(col++, "x");
                }
            } else {
                col++;
            }
        }
    } else {
        col += choices.size();
    }
    return col;
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier)

Example 34 with Identifier

use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.

the class AuditLogFormatter method log.

protected static void log(CandidateEvent candidateEvent, Map<Identifier, AssessmentResponse> candidateResponseMap, Writer writer) throws IOException {
    writer.append("QTI21 audit [");
    AssessmentTestSession testSession = candidateEvent.getCandidateSession();
    if (testSession != null) {
        RepositoryEntryRef testEntry = candidateEvent.getTestEntry();
        RepositoryEntryRef courseEntry = candidateEvent.getRepositoryEntry();
        if (courseEntry != null && !testEntry.getKey().equals(courseEntry.getKey())) {
            writer.write(courseEntry.getKey().toString());
            writer.write(":");
            if (testSession.getSubIdent() == null) {
                writer.write("NULL:");
            } else {
                writer.write(testSession.getSubIdent());
                writer.write(":");
            }
        }
        if (testEntry != null) {
            writer.write(testEntry.getKey().toString());
        }
    }
    writer.write("] ");
    if (candidateEvent.getTestEventType() != null) {
        writer.append("TestEvent:");
        writer.append(candidateEvent.getTestEventType().toString());
        writer.write(" ");
    }
    if (candidateEvent.getItemEventType() != null) {
        writer.append("ItemEvent:");
        writer.append(candidateEvent.getItemEventType().toString());
        writer.write(" ");
    }
    if (candidateEvent.getTestItemKey() != null) {
        writer.append("TestItemKey[");
        writer.append(candidateEvent.getTestItemKey());
        writer.write("] ");
    }
    if (candidateResponseMap != null) {
        writer.write("params=");
        for (Map.Entry<Identifier, AssessmentResponse> responseEntry : candidateResponseMap.entrySet()) {
            Identifier identifier = responseEntry.getKey();
            AssessmentResponse response = responseEntry.getValue();
            writer.append("|");
            writer.append(identifier.toString());
            writer.append("=");
            String stringuifiedResponse = response.getStringuifiedResponse();
            if (stringuifiedResponse == null) {
                writer.append("NULL");
            } else {
                writer.append(stringuifiedResponse);
            }
        }
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef) Map(java.util.Map) AssessmentResponse(org.olat.ims.qti21.AssessmentResponse)

Example 35 with Identifier

use of uk.ac.ed.ph.jqtiplus.types.Identifier in project OpenOLAT by OpenOLAT.

the class HottextInteractionArchive method writeInteractionData.

@Override
public int writeInteractionData(AssessmentItem item, AssessmentResponse response, Interaction interaction, int itemNumber, Row dataRow, int col, OpenXMLWorkbook workbook) {
    String stringuifiedResponse = response == null ? null : response.getStringuifiedResponse();
    List<String> responses = CorrectResponsesUtil.parseResponses(stringuifiedResponse);
    List<Identifier> correctAnswers = CorrectResponsesUtil.getCorrectIdentifierResponses(item, interaction);
    List<Hottext> texts = getHottexts(interaction);
    for (int i = 0; i < texts.size(); i++) {
        Hottext text = texts.get(i);
        Identifier textIdentifier = text.getIdentifier();
        // user select this hot text
        if (responses.contains(text.getIdentifier().toString())) {
            String content = getContent(text);
            // correct -> must be clicked
            boolean correct = correctAnswers.contains(textIdentifier);
            if (correct) {
                dataRow.addCell(col++, content, workbook.getStyles().getCorrectStyle());
            } else {
                dataRow.addCell(col++, content, null);
            }
        } else {
            // correct -> must not be clicked
            boolean correct = !correctAnswers.contains(textIdentifier);
            if (correct) {
                dataRow.addCell(col++, "", workbook.getStyles().getCorrectStyle());
            } else {
                col++;
            }
        }
    }
    return col;
}
Also used : Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) Hottext(uk.ac.ed.ph.jqtiplus.node.item.interaction.content.Hottext)

Aggregations

Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)208 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)62 ArrayList (java.util.ArrayList)53 HashMap (java.util.HashMap)52 SingleValue (uk.ac.ed.ph.jqtiplus.value.SingleValue)46 ComplexReferenceIdentifier (uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier)42 Value (uk.ac.ed.ph.jqtiplus.value.Value)42 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)40 Map (java.util.Map)32 SimpleAssociableChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleAssociableChoice)24 DirectedPairValue (uk.ac.ed.ph.jqtiplus.value.DirectedPairValue)24 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)24 ItemBody (uk.ac.ed.ph.jqtiplus.node.content.ItemBody)22 CorrectResponse (uk.ac.ed.ph.jqtiplus.node.item.CorrectResponse)22 ResponseProcessing (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing)22 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)22 List (java.util.List)20 ChoiceInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction)20 SimpleChoice (uk.ac.ed.ph.jqtiplus.node.item.interaction.choice.SimpleChoice)20 RecordValue (uk.ac.ed.ph.jqtiplus.value.RecordValue)20