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

OO-1047: let the single choice override the maxvalue if necessary, set the 0...

OO-1047: let the single choice override the maxvalue if necessary, set the 0 score in the Java Object for the editor instead of the default value 1
parent 82b4a4e1
No related branches found
No related tags found
No related merge requests found
...@@ -131,6 +131,9 @@ public class ChoiceQuestion extends Question implements QTIObject { ...@@ -131,6 +131,9 @@ public class ChoiceQuestion extends Question implements QTIObject {
choice.setCorrect(true); choice.setCorrect(true);
} }
} }
// set min/max score first has it can be overridden
QTIEditHelper.configureMinMaxScore(instance, (Element) resprocessingXML.selectSingleNode(".//decvar"));
// get type of multiple choice // get type of multiple choice
if (instance.getType() == TYPE_MC) { if (instance.getType() == TYPE_MC) {
...@@ -144,12 +147,13 @@ public class ChoiceQuestion extends Question implements QTIObject { ...@@ -144,12 +147,13 @@ public class ChoiceQuestion extends Question implements QTIObject {
instance.setSingleCorrect(false); instance.setSingleCorrect(false);
} }
} else if (instance.getType() == TYPE_SC) { } else if (instance.getType() == TYPE_SC) {
instance.setSingleCorrect(true);
Collection<Float> values = points.values(); Collection<Float> values = points.values();
if (values.size() > 0) { if (values.size() > 0) {
instance.setSingleCorrect(true);
instance.setSingleCorrectScore(((Float) (values.iterator().next())).floatValue()); instance.setSingleCorrectScore(((Float) (values.iterator().next())).floatValue());
} else { } else {
instance.setSingleCorrect(false); instance.setSingleCorrect(false);
instance.setSingleCorrectScore(0f);
} }
} else if (instance.getType() == TYPE_KPRIM) { } else if (instance.getType() == TYPE_KPRIM) {
instance.setSingleCorrect(false); instance.setSingleCorrect(false);
...@@ -176,8 +180,7 @@ public class ChoiceQuestion extends Question implements QTIObject { ...@@ -176,8 +180,7 @@ public class ChoiceQuestion extends Question implements QTIObject {
} }
} }
// set min/max score
QTIEditHelper.configureMinMaxScore(instance, (Element) resprocessingXML.selectSingleNode(".//decvar"));
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
/* /*
......
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