Skip to content
Snippets Groups Projects
Commit be181427 authored by srosse's avatar srosse
Browse files

no-jira: add message to missing response delcaration in FIB to debug

parent e8712576
No related branches found
No related tags found
No related merge requests found
......@@ -334,7 +334,10 @@ public class CorrectResponsesUtil {
public static final AbstractEntry getCorrectTextResponses(AssessmentItem assessmentItem, TextEntryInteraction interaction) {
ResponseDeclaration responseDeclaration = assessmentItem.getResponseDeclaration(interaction.getResponseIdentifier());
if(responseDeclaration.hasBaseType(BaseType.STRING) && responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
if(responseDeclaration == null) {
log.error("Missing declaration for interaction: {} of assessment item: {}", interaction, assessmentItem);
return null;
} else if(responseDeclaration.hasBaseType(BaseType.STRING) && responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
TextEntry textEntry = new TextEntry(interaction);
FIBAssessmentItemBuilder.extractTextEntrySettingsFromResponseDeclaration(textEntry, responseDeclaration, new AtomicInteger(), new DoubleAdder());
return textEntry;
......
......@@ -603,7 +603,9 @@ public class AssessmentObjectVelocityRenderDecorator extends VelocityRenderDecor
}
public Boolean isCorrectTextEntry(TextEntryInteraction textEntry) {
if(textEntry == null) return null;
if(textEntry == null) {
return null;
}
Value val = getResponseValue(textEntry.getResponseIdentifier());
if(val == null) {
......@@ -612,6 +614,9 @@ public class AssessmentObjectVelocityRenderDecorator extends VelocityRenderDecor
String stringuifiedResponses = toString(val);
AbstractEntry correctAnswers = CorrectResponsesUtil.getCorrectTextResponses(assessmentItem, textEntry);
if(correctAnswers == null) {
return null;
}
stringuifiedResponses = CorrectResponsesUtil.stripResponse(stringuifiedResponses);
boolean correct = correctAnswers.match(stringuifiedResponses);
return Boolean.valueOf(correct);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment