Search in sources :

Example 1 with TestFeedback

use of uk.ac.ed.ph.jqtiplus.node.test.TestFeedback in project openolat by klemens.

the class AssessmentTestBuilder method buildFeedback.

private void buildFeedback(TestFeedbackBuilder feedbackBuilder, boolean passed) {
    if (htmlBuilder.containsSomething(feedbackBuilder.getText())) {
        TestFeedback testFeedback;
        if (feedbackBuilder.getTestFeedback() == null) {
            testFeedback = AssessmentTestFactory.createTestFeedbackModal(assessmentTest, IdentifierGenerator.newAsIdentifier("fm"), feedbackBuilder.getTitle(), feedbackBuilder.getText());
            assessmentTest.getTestFeedbacks().add(testFeedback);
        } else {
            testFeedback = feedbackBuilder.getTestFeedback();
            testFeedback.setTitle(feedbackBuilder.getTitle());
            htmlBuilder.appendHtml(testFeedback, feedbackBuilder.getText());
        }
        OutcomeCondition outcomeCondition = AssessmentTestFactory.createTestFeedbackModalCondition(assessmentTest, passed, testFeedback.getOutcomeValue());
        assessmentTest.getOutcomeProcessing().getOutcomeRules().add(outcomeCondition);
    } else if (feedbackBuilder.getTestFeedback() != null) {
        assessmentTest.getTestFeedbacks().remove(feedbackBuilder.getTestFeedback());
    }
}
Also used : TestFeedback(uk.ac.ed.ph.jqtiplus.node.test.TestFeedback) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)

Example 2 with TestFeedback

use of uk.ac.ed.ph.jqtiplus.node.test.TestFeedback in project openolat by klemens.

the class AssessmentTestFactory method createTestFeedbackModal.

/*
	<testFeedback identifier="Feedback952020414" outcomeIdentifier="FEEDBACKMODAL" showHide="show" access="atEnd" title="Correct answer">
		<p>This is the correct answer</p>
	</testFeedback>
	 */
public static final TestFeedback createTestFeedbackModal(AssessmentTest assessmentTest, Identifier identifier, String title, String text) {
    TestFeedback testFeedback = new TestFeedback(assessmentTest);
    testFeedback.setOutcomeValue(identifier);
    testFeedback.setOutcomeIdentifier(QTI21Constants.FEEDBACKMODAL_IDENTIFIER);
    testFeedback.setVisibilityMode(VisibilityMode.SHOW_IF_MATCH);
    testFeedback.setTestFeedbackAccess(TestFeedbackAccess.AT_END);
    testFeedback.setTitle(title);
    new AssessmentHtmlBuilder().appendHtml(testFeedback, text);
    return testFeedback;
}
Also used : TestFeedback(uk.ac.ed.ph.jqtiplus.node.test.TestFeedback)

Example 3 with TestFeedback

use of uk.ac.ed.ph.jqtiplus.node.test.TestFeedback in project OpenOLAT by OpenOLAT.

the class AssessmentTestBuilder method buildFeedback.

private void buildFeedback(TestFeedbackBuilder feedbackBuilder, boolean passed) {
    if (htmlBuilder.containsSomething(feedbackBuilder.getText())) {
        TestFeedback testFeedback;
        if (feedbackBuilder.getTestFeedback() == null) {
            testFeedback = AssessmentTestFactory.createTestFeedbackModal(assessmentTest, IdentifierGenerator.newAsIdentifier("fm"), feedbackBuilder.getTitle(), feedbackBuilder.getText());
            assessmentTest.getTestFeedbacks().add(testFeedback);
        } else {
            testFeedback = feedbackBuilder.getTestFeedback();
            testFeedback.setTitle(feedbackBuilder.getTitle());
            htmlBuilder.appendHtml(testFeedback, feedbackBuilder.getText());
        }
        OutcomeCondition outcomeCondition = AssessmentTestFactory.createTestFeedbackModalCondition(assessmentTest, passed, testFeedback.getOutcomeValue());
        assessmentTest.getOutcomeProcessing().getOutcomeRules().add(outcomeCondition);
    } else if (feedbackBuilder.getTestFeedback() != null) {
        assessmentTest.getTestFeedbacks().remove(feedbackBuilder.getTestFeedback());
    }
}
Also used : TestFeedback(uk.ac.ed.ph.jqtiplus.node.test.TestFeedback) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)

Example 4 with TestFeedback

use of uk.ac.ed.ph.jqtiplus.node.test.TestFeedback in project OpenOLAT by OpenOLAT.

the class AssessmentTestFactory method createTestFeedbackModal.

/*
	<testFeedback identifier="Feedback952020414" outcomeIdentifier="FEEDBACKMODAL" showHide="show" access="atEnd" title="Correct answer">
		<p>This is the correct answer</p>
	</testFeedback>
	 */
public static final TestFeedback createTestFeedbackModal(AssessmentTest assessmentTest, Identifier identifier, String title, String text) {
    TestFeedback testFeedback = new TestFeedback(assessmentTest);
    testFeedback.setOutcomeValue(identifier);
    testFeedback.setOutcomeIdentifier(QTI21Constants.FEEDBACKMODAL_IDENTIFIER);
    testFeedback.setVisibilityMode(VisibilityMode.SHOW_IF_MATCH);
    testFeedback.setTestFeedbackAccess(TestFeedbackAccess.AT_END);
    testFeedback.setTitle(title);
    new AssessmentHtmlBuilder().appendHtml(testFeedback, text);
    return testFeedback;
}
Also used : TestFeedback(uk.ac.ed.ph.jqtiplus.node.test.TestFeedback)

Aggregations

TestFeedback (uk.ac.ed.ph.jqtiplus.node.test.TestFeedback)4 OutcomeCondition (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)2