Search in sources :

Example 1 with ModalFeedback

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

the class AssessmentItemFactory method createModalFeedback.

public static ModalFeedback createModalFeedback(AssessmentItem assessmentItem, Identifier outcomeIdentifier, Identifier identifier, String title, String text) {
    /*
		<modalFeedback identifier="Feedback1041659806" outcomeIdentifier="FEEDBACKMODAL" showHide="show" title="Wrong answer">
			<p>Feedback answer</p>
		</modalFeedback>
		*/
    ModalFeedback modalFeedback = new ModalFeedback(assessmentItem);
    modalFeedback.setIdentifier(identifier);
    modalFeedback.setOutcomeIdentifier(outcomeIdentifier);
    modalFeedback.setVisibilityMode(VisibilityMode.parseVisibilityMode("show"));
    modalFeedback.getAttributes().getStringAttribute(ModalFeedback.ATTR_TITLE_NAME).setValue(title);
    new AssessmentHtmlBuilder().appendHtml(modalFeedback, text);
    return modalFeedback;
}
Also used : ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)

Example 2 with ModalFeedback

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

the class QTI21WordExport method renderCorrectSolutionForWord.

private static void renderCorrectSolutionForWord(AssessmentItem item, OpenXMLDocument document, Translator translator, AssessmentHtmlBuilder htmlBuilder) {
    List<ModalFeedback> feedbacks = item.getModalFeedbacks();
    if (feedbacks != null && feedbacks.size() > 0) {
        for (ModalFeedback feedback : feedbacks) {
            if (feedback.getOutcomeIdentifier() != null && QTI21Constants.CORRECT_SOLUTION_IDENTIFIER.equals(feedback.getOutcomeIdentifier())) {
                Attribute<?> title = feedback.getAttributes().get("title");
                String feedbackTitle = null;
                if (title != null && title.getValue() != null) {
                    feedbackTitle = title.getValue().toString();
                }
                if (!StringHelper.containsNonWhitespace(feedbackTitle)) {
                    feedbackTitle = translator.translate("correct.solution");
                }
                document.appendHeading2(feedbackTitle, null);
                String html = htmlBuilder.flowStaticString(feedback.getFlowStatics());
                document.appendHtmlText(html, true);
            }
        }
    }
}
Also used : ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)

Example 3 with ModalFeedback

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

the class AlienItemAnalyzer method checkFeedbackModalResponseProcessing.

private void checkFeedbackModalResponseProcessing(Report report) {
    if (report.getType() != QTI21QuestionType.unkown) {
        boolean allOk = true;
        List<ModalFeedback> feedbacks = item.getModalFeedbacks();
        for (ModalFeedback feedback : feedbacks) {
            ModalFeedbackBuilder feedbackBuilder = new ModalFeedbackBuilder(item, feedback);
            if (feedbackBuilder.isCorrectRule() || feedbackBuilder.isIncorrectRule()) {
            // ok
            } else if (feedbackBuilder.isCorrectSolutionRule() || (feedback.getOutcomeIdentifier() != null && QTI21Constants.CORRECT_SOLUTION_IDENTIFIER.equals(feedback.getOutcomeIdentifier()))) {
            // ok
            } else if (feedbackBuilder.isEmptyRule() || feedbackBuilder.isAnsweredRule() || feedbackBuilder.isHint()) {
            // ok
            } else {
                List<ModalFeedbackCondition> conditions = feedbackBuilder.getFeedbackConditons();
                if (conditions == null || conditions.isEmpty()) {
                    allOk &= false;
                }
            }
        }
        if (!allOk) {
            report.addWarning(ReportWarningEnum.unsupportedFeedbacks);
        }
    }
}
Also used : ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)

Example 4 with ModalFeedback

use of uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback 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 5 with ModalFeedback

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

the class AssessmentItemBuilder method build.

public final void build() {
    List<OutcomeDeclaration> outcomeDeclarations = assessmentItem.getOutcomeDeclarations();
    outcomeDeclarations.clear();
    ResponseProcessing responseProcessing = assessmentItem.getResponseProcessing();
    List<ResponseRule> responseRules = responseProcessing.getResponseRules();
    responseRules.clear();
    List<ResponseDeclaration> responseDeclarations = assessmentItem.getResponseDeclarations();
    responseDeclarations.clear();
    List<ModalFeedback> modalFeedbacks = assessmentItem.getModalFeedbacks();
    modalFeedbacks.clear();
    buildItemBody();
    buildResponseAndOutcomeDeclarations();
    buildModalFeedbacksAndHints(outcomeDeclarations, responseRules);
    buildMinMaxScores(outcomeDeclarations, responseRules);
    buildMainScoreRule(outcomeDeclarations, responseRules);
    buildHint(outcomeDeclarations, responseRules);
}
Also used : ModalFeedback(uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback) ResponseProcessing(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration) ResponseDeclaration(uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration) ResponseRule(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseRule)

Aggregations

ModalFeedback (uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback)30 Identifier (uk.ac.ed.ph.jqtiplus.types.Identifier)10 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)8 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)6 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)6 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)6 ResponseDeclaration (uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration)4 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)4 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ModalFeedbackType (org.olat.ims.qti21.model.xml.ModalFeedbackBuilder.ModalFeedbackType)2 P (uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P)2 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)2 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)2 EndAttemptInteraction (uk.ac.ed.ph.jqtiplus.node.item.interaction.EndAttemptInteraction)2 Interaction (uk.ac.ed.ph.jqtiplus.node.item.interaction.Interaction)2 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)2 ResponseProcessing (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing)2 ResponseRule (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseRule)2