use of uk.ac.ed.ph.jqtiplus.node.result.ItemVariable in project openolat by klemens.
the class AssessmentTestDisplayController method processOutcomeVariables.
private void processOutcomeVariables(TestResult resultNode, TestPlanInfos testPlanInfos, boolean submit) {
Float score = null;
Boolean pass = null;
double completion = testPlanInfos.getCompletion();
for (final ItemVariable itemVariable : resultNode.getItemVariables()) {
if (itemVariable instanceof OutcomeVariable) {
OutcomeVariable outcomeVariable = (OutcomeVariable) itemVariable;
Identifier identifier = outcomeVariable.getIdentifier();
if (QTI21Constants.SCORE_IDENTIFIER.equals(identifier)) {
Value value = itemVariable.getComputedValue();
if (value instanceof NumberValue) {
score = (float) ((NumberValue) value).doubleValue();
}
} else if (QTI21Constants.PASS_IDENTIFIER.equals(identifier)) {
Value value = itemVariable.getComputedValue();
if (value instanceof BooleanValue) {
pass = ((BooleanValue) value).booleanValue();
}
}
}
}
if (submit) {
outcomesListener.submit(score, pass, completion, candidateSession.getKey());
} else if (candidateSession != null && candidateSession.getFinishTime() == null) {
// don't change the outcome if the test is finished
outcomesListener.updateOutcomes(score, pass, completion);
}
}
Aggregations