use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue in project openolat by klemens.
the class AssessmentItemFactory method createMinScoreBoundLimitRule.
/**
* Rule which ensure that the final score is not under the min. score value.
*/
public static ResponseRule createMinScoreBoundLimitRule(ResponseProcessing responseProcessing) {
/*
<responseCondition>
<responseIf>
<lt>
<variable identifier="SCORE" /><variable identifier="MINSCORE" />
</lt>
<setOutcomeValue identifier="SCORE">
<variable identifier="MINSCORE" />
</setOutcomeValue>
</responseIf>
</responseCondition>
*/
ResponseCondition rule = new ResponseCondition(responseProcessing);
ResponseIf responseIf = new ResponseIf(rule);
rule.setResponseIf(responseIf);
Lt lt = new Lt(responseIf);
responseIf.setExpression(lt);
Variable scoreVar = new Variable(lt);
scoreVar.setIdentifier(SCORE_CLX_IDENTIFIER);
lt.getExpressions().add(scoreVar);
Variable minScoreVar = new Variable(lt);
minScoreVar.setIdentifier(MINSCORE_CLX_IDENTIFIER);
lt.getExpressions().add(minScoreVar);
SetOutcomeValue setOutcomeValue = new SetOutcomeValue(responseIf);
setOutcomeValue.setIdentifier(SCORE_IDENTIFIER);
Variable minScoreOutcomeVar = new Variable(setOutcomeValue);
minScoreOutcomeVar.setIdentifier(MINSCORE_CLX_IDENTIFIER);
setOutcomeValue.setExpression(minScoreOutcomeVar);
responseIf.getResponseRules().add(setOutcomeValue);
return rule;
}
Aggregations