use of uk.ac.ed.ph.jqtiplus.value.BaseType in project openolat by klemens.
the class AssessmentItemChecker method checkSetCorrectResponse.
/**
* responseDeclaration -> float
*
* templateVraiable -> integer
*
* setCorrectResponse
* -> variable -> integer doesn't match float -> issue
* @param item
* @return
*/
private static boolean checkSetCorrectResponse(AssessmentItem item) {
boolean allOk = true;
List<SetCorrectResponse> setCorrectResponses = QueryUtils.search(SetCorrectResponse.class, item);
for (SetCorrectResponse setCorrectResponse : setCorrectResponses) {
Identifier responseIdentifier = setCorrectResponse.getIdentifier();
ResponseDeclaration responseDeclaration = item.getResponseDeclaration(responseIdentifier);
BaseType baseType = responseDeclaration.getBaseType();
Expression expression = setCorrectResponse.getExpression();
if (expression instanceof Variable) {
Variable variable = (Variable) expression;
ComplexReferenceIdentifier cpxVariableIdentifier = variable.getIdentifier();
Identifier variableIdentifier = Identifier.assumedLegal(cpxVariableIdentifier.toString());
TemplateDeclaration templateDeclaration = item.getTemplateDeclaration(variableIdentifier);
if (templateDeclaration != null && !templateDeclaration.hasBaseType(baseType)) {
templateDeclaration.setBaseType(baseType);
allOk &= false;
}
}
}
return allOk;
}
use of uk.ac.ed.ph.jqtiplus.value.BaseType in project OpenOLAT by OpenOLAT.
the class AssessmentItemChecker method checkSetCorrectResponse.
/**
* responseDeclaration -> float
*
* templateVraiable -> integer
*
* setCorrectResponse
* -> variable -> integer doesn't match float -> issue
* @param item
* @return
*/
private static boolean checkSetCorrectResponse(AssessmentItem item) {
boolean allOk = true;
List<SetCorrectResponse> setCorrectResponses = QueryUtils.search(SetCorrectResponse.class, item);
for (SetCorrectResponse setCorrectResponse : setCorrectResponses) {
Identifier responseIdentifier = setCorrectResponse.getIdentifier();
ResponseDeclaration responseDeclaration = item.getResponseDeclaration(responseIdentifier);
BaseType baseType = responseDeclaration.getBaseType();
Expression expression = setCorrectResponse.getExpression();
if (expression instanceof Variable) {
Variable variable = (Variable) expression;
ComplexReferenceIdentifier cpxVariableIdentifier = variable.getIdentifier();
Identifier variableIdentifier = Identifier.assumedLegal(cpxVariableIdentifier.toString());
TemplateDeclaration templateDeclaration = item.getTemplateDeclaration(variableIdentifier);
if (templateDeclaration != null && !templateDeclaration.hasBaseType(baseType)) {
templateDeclaration.setBaseType(baseType);
allOk &= false;
}
}
}
return allOk;
}
Aggregations