Search in sources :

Example 6 with TestVariables

use of uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables in project OpenOLAT by OpenOLAT.

the class AssessmentTestBuilder method buildTestScore.

/* Overall score of this test
	<setOutcomeValue identifier="SCORE">
		<sum>
			<testVariables variableIdentifier="SCORE" />
		</sum>
	</setOutcomeValue>
	*/
private void buildTestScore() {
    if (testScoreRule == null) {
        SetOutcomeValue scoreRule = new SetOutcomeValue(assessmentTest);
        scoreRule.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        Sum sum = new Sum(scoreRule);
        scoreRule.getExpressions().add(sum);
        TestVariables testVariables = new TestVariables(sum);
        sum.getExpressions().add(testVariables);
        testVariables.setVariableIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        assessmentTest.getOutcomeProcessing().getOutcomeRules().add(0, scoreRule);
        testScoreRule = scoreRule;
    }
    if (minScoreRule == null) {
        OutcomeCondition scoreRule = AssessmentTestFactory.createMinScoreRule(assessmentTest);
        assessmentTest.getOutcomeProcessing().getOutcomeRules().add(1, scoreRule);
        minScoreRule = scoreRule;
    }
}
Also used : SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) TestVariables(uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)

Aggregations

Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)6 TestVariables (uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)6 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue)4 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)2 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)2 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)2 OutcomeCondition (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)2 OutcomeProcessing (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeProcessing)2