Search in sources :

Example 6 with OutcomeRule

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule in project openolat by klemens.

the class TestFeedbackBuilder method findFeedbackRuleInSetOutcomeVariable.

private boolean findFeedbackRuleInSetOutcomeVariable(OutcomeRule responseRule, Identifier feedbackIdentifier) {
    if (responseRule instanceof OutcomeCondition) {
        OutcomeCondition outcomeCondition = (OutcomeCondition) responseRule;
        OutcomeIf outcomeIf = outcomeCondition.getOutcomeIf();
        List<OutcomeRule> ifOutcomeRules = outcomeIf.getOutcomeRules();
        for (OutcomeRule ifOutcomeRule : ifOutcomeRules) {
            if (ifOutcomeRule instanceof SetOutcomeValue) {
                SetOutcomeValue setOutcomeValue = (SetOutcomeValue) ifOutcomeRule;
                if (findFeedbackRuleInExpression(setOutcomeValue.getExpression(), feedbackIdentifier)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeIf(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeIf) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) OutcomeRule(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)

Example 7 with OutcomeRule

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule in project OpenOLAT by OpenOLAT.

the class TestFeedbackBuilder method findFeedbackRuleInSetOutcomeVariable.

private boolean findFeedbackRuleInSetOutcomeVariable(OutcomeRule responseRule, Identifier feedbackIdentifier) {
    if (responseRule instanceof OutcomeCondition) {
        OutcomeCondition outcomeCondition = (OutcomeCondition) responseRule;
        OutcomeIf outcomeIf = outcomeCondition.getOutcomeIf();
        List<OutcomeRule> ifOutcomeRules = outcomeIf.getOutcomeRules();
        for (OutcomeRule ifOutcomeRule : ifOutcomeRules) {
            if (ifOutcomeRule instanceof SetOutcomeValue) {
                SetOutcomeValue setOutcomeValue = (SetOutcomeValue) ifOutcomeRule;
                if (findFeedbackRuleInExpression(setOutcomeValue.getExpression(), feedbackIdentifier)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeIf(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeIf) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) OutcomeRule(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)

Example 8 with OutcomeRule

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule in project openolat by klemens.

the class AssessmentTestBuilder method extractRules.

private void extractRules() {
    if (assessmentTest.getOutcomeProcessing() != null) {
        List<OutcomeRule> outcomeRules = assessmentTest.getOutcomeProcessing().getOutcomeRules();
        for (OutcomeRule outcomeRule : outcomeRules) {
            // export test score
            if (outcomeRule instanceof SetOutcomeValue) {
                SetOutcomeValue setOutcomeValue = (SetOutcomeValue) outcomeRule;
                if (QTI21Constants.SCORE_IDENTIFIER.equals(setOutcomeValue.getIdentifier())) {
                    testScoreRule = outcomeRule;
                }
            }
            // pass rule
            if (outcomeRule instanceof OutcomeCondition) {
                OutcomeCondition outcomeCondition = (OutcomeCondition) outcomeRule;
                boolean findIf = QtiNodesExtractor.findSetOutcomeValue(outcomeCondition.getOutcomeIf(), QTI21Constants.PASS_IDENTIFIER);
                boolean findElse = QtiNodesExtractor.findSetOutcomeValue(outcomeCondition.getOutcomeElse(), QTI21Constants.PASS_IDENTIFIER);
                if (findIf && findElse) {
                    cutValue = QtiNodesExtractor.extractCutValue(outcomeCondition.getOutcomeIf());
                    cutValueRule = outcomeCondition;
                }
                boolean findMinIf = QtiNodesExtractor.findLtValue(outcomeCondition.getOutcomeIf(), QTI21Constants.MINSCORE_IDENTIFIER) && QtiNodesExtractor.findLtValue(outcomeCondition.getOutcomeIf(), QTI21Constants.SCORE_IDENTIFIER);
                if (findMinIf) {
                    minScoreRule = outcomeCondition;
                }
            }
        }
    }
}
Also used : SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) OutcomeRule(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)

Example 9 with OutcomeRule

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule in project openolat by klemens.

the class QTI21WordExport method renderAssessmentTest.

public void renderAssessmentTest(AssessmentTest assessmentTest, OpenXMLDocument document, Translator translator) {
    String title = assessmentTest.getTitle();
    document.appendTitle(title);
    if (assessmentTest.getOutcomeProcessing() != null) {
        List<OutcomeRule> outcomeRules = assessmentTest.getOutcomeProcessing().getOutcomeRules();
        for (OutcomeRule outcomeRule : outcomeRules) {
            // pass rule
            if (outcomeRule instanceof OutcomeCondition) {
                OutcomeCondition outcomeCondition = (OutcomeCondition) outcomeRule;
                boolean findIf = QtiNodesExtractor.findSetOutcomeValue(outcomeCondition.getOutcomeIf(), QTI21Constants.PASS_IDENTIFIER);
                boolean findElse = QtiNodesExtractor.findSetOutcomeValue(outcomeCondition.getOutcomeElse(), QTI21Constants.PASS_IDENTIFIER);
                if (findIf && findElse) {
                    Double cutValue = QtiNodesExtractor.extractCutValue(outcomeCondition.getOutcomeIf());
                    String cutValueLabel = translator.translate("cut.value");
                    document.appendText(cutValueLabel + ": " + AssessmentHelper.getRoundedScore(cutValue), true);
                }
            }
        }
    }
}
Also used : OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) OutcomeRule(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)

Example 10 with OutcomeRule

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule in project openolat by klemens.

the class QtiNodesExtractor method extractCutValue.

public static Double extractCutValue(AssessmentTest assessmentTest) {
    Double cutValue = null;
    if (assessmentTest.getOutcomeProcessing() != null) {
        List<OutcomeRule> outcomeRules = assessmentTest.getOutcomeProcessing().getOutcomeRules();
        for (OutcomeRule outcomeRule : outcomeRules) {
            if (outcomeRule instanceof OutcomeCondition) {
                OutcomeCondition outcomeCondition = (OutcomeCondition) outcomeRule;
                boolean findIf = findSetOutcomeValue(outcomeCondition.getOutcomeIf(), QTI21Constants.PASS_IDENTIFIER);
                boolean findElse = findSetOutcomeValue(outcomeCondition.getOutcomeElse(), QTI21Constants.PASS_IDENTIFIER);
                if (findIf && findElse) {
                    cutValue = extractCutValue(outcomeCondition.getOutcomeIf());
                }
            }
        }
    }
    return cutValue;
}
Also used : OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) OutcomeRule(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)

Aggregations

OutcomeCondition (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)10 OutcomeRule (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)10 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue)6 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)2 OutcomeIf (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeIf)2