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

OO-2983: validate the scores for match interactions

parent bd32ca3f
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; ...@@ -38,6 +38,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.util.CodeHelper; import org.olat.core.util.CodeHelper;
import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.course.assessment.AssessmentHelper; import org.olat.course.assessment.AssessmentHelper;
import org.olat.ims.qti21.model.xml.AssessmentHtmlBuilder; import org.olat.ims.qti21.model.xml.AssessmentHtmlBuilder;
...@@ -215,9 +216,23 @@ public class MatchScoreController extends AssessmentItemRefEditorController impl ...@@ -215,9 +216,23 @@ public class MatchScoreController extends AssessmentItemRefEditorController impl
allOk &= validateDouble(maxScoreEl); allOk &= validateDouble(maxScoreEl);
if(assessmentModeEl.isOneSelected() && assessmentModeEl.isSelected(1)) { if(assessmentModeEl.isOneSelected() && assessmentModeEl.isSelected(1)) {
/*for(HotspotChoiceWrapper wrapper:wrappers) { for(Map.Entry<DirectedPairValue, MatchScoreWrapper> entry:scoreWrappers.entrySet()) {
allOk &= validateDouble(wrapper.getPointsEl()); MatchScoreWrapper scoreWrapper = entry.getValue();
}*/ TextElement scoreEl = scoreWrapper.getScoreEl();
String val = scoreEl.getValue();
scoreEl.clearError();
if(StringHelper.containsNonWhitespace(val)) {
try {
Double.parseDouble(val);
} catch (NumberFormatException e) {
scoreEl.setErrorKey("error.double", null);
allOk &= false;
}
} else {
scoreEl.setErrorKey("form.legende.mandatory", null);
allOk &= false;
}
}
} }
return allOk & super.validateFormLogic(ureq); return allOk & super.validateFormLogic(ureq);
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#if(${scoreWrapper.isCorrect()}) #if(${scoreWrapper.isCorrect()})
<i class=" o_icon o_icon-lg o_icon_accept"> </i> <i class=" o_icon o_icon-lg o_icon_accept"> </i>
#end #end
#if($f.hasError("${sourceChoice.getChoiceIdentifier().toString()}-${targetChoice.getChoiceIdentifier().toString()}"))
<div>$r.render("${sourceChoice.getChoiceIdentifier().toString()}-${targetChoice.getChoiceIdentifier().toString()}_ERROR")</div>
#end
</td> </td>
#end #end
</tr> </tr>
......
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