use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition 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;
}
use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition in project openolat by klemens.
the class TestFeedbackBuilder method findFeedbackMatch.
private boolean findFeedbackMatch(OutcomeRule outcomeRule, boolean pass, ComplexReferenceIdentifier id) {
if (outcomeRule instanceof OutcomeCondition) {
OutcomeCondition outcomeCondition = (OutcomeCondition) outcomeRule;
OutcomeIf outcomeIf = outcomeCondition.getOutcomeIf();
if (outcomeIf != null && outcomeIf.getExpressions().size() == 1) {
Expression mustBeAnd = outcomeIf.getExpressions().get(0);
if (mustBeAnd instanceof And && mustBeAnd.getExpressions().size() == 1) {
Expression mustBeMatch = mustBeAnd.getExpressions().get(0);
if (mustBeMatch instanceof Match && mustBeMatch.getExpressions().size() == 2) {
return findFeedbackMatch((Match) mustBeMatch, pass, id);
}
}
}
}
return false;
}
Aggregations