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

OO-910: kprim need a special "fetchPoint" as the negative and positive values are important

parent 7c54e8ce
No related branches found
No related tags found
No related merge requests found
......@@ -223,22 +223,15 @@ public class QTIWordExport implements MediaResource {
ChoiceQuestion choice = (ChoiceQuestion)question;
if(question.getType() == Question.TYPE_SC) {
questionType = translator.translate("item.type.sc");
fetchPointsOfMultipleChoices(itemEl, choice, iinput);
} else if(question.getType() == Question.TYPE_MC) {
questionType = translator.translate("item.type.mc");
fetchPointsOfMultipleChoices(itemEl, choice, iinput);
} else if (question.getType() == Question.TYPE_KPRIM) {
questionType = translator.translate("item.type.kprim");
fetchPointsOfKPrim(itemEl, choice, iinput);
}
Element resprocessingXML = itemEl.element("resprocessing");
if(resprocessingXML != null) {
List<?> respconditions = resprocessingXML.elements("respcondition");
Map<String,Float> points = QTIEditHelper.fetchPoints(respconditions, choice.getType());
for(Map.Entry<String,Float> entryPoint:points.entrySet()) {
Float val = entryPoint.getValue();
if(val != null && val.floatValue() > 0.0f) {
iinput.put(entryPoint.getKey(), entryPoint.getKey());
}
}
}
} else if(question instanceof FIBQuestion) {
questionType = translator.translate("item.type.sc");
for (Response response: question.getResponses()) {
......@@ -266,6 +259,34 @@ public class QTIWordExport implements MediaResource {
foo.renderOpenXML(document, renderInstructions);
}
private static void fetchPointsOfKPrim(Element itemEl, ChoiceQuestion choice, Map<String,String> iinput) {
Element resprocessingXML = itemEl.element("resprocessing");
if(resprocessingXML != null) {
List<?> respconditions = resprocessingXML.elements("respcondition");
Map<String,Float> points = QTIEditHelper.fetchPoints(respconditions, choice.getType());
for(Map.Entry<String,Float> entryPoint:points.entrySet()) {
Float val = entryPoint.getValue();
if(val != null) {
iinput.put(entryPoint.getKey(), entryPoint.getKey());
}
}
}
}
private static void fetchPointsOfMultipleChoices(Element itemEl, ChoiceQuestion choice, Map<String,String> iinput) {
Element resprocessingXML = itemEl.element("resprocessing");
if(resprocessingXML != null) {
List<?> respconditions = resprocessingXML.elements("respcondition");
Map<String,Float> points = QTIEditHelper.fetchPoints(respconditions, choice.getType());
for(Map.Entry<String,Float> entryPoint:points.entrySet()) {
Float val = entryPoint.getValue();
if(val != null && val.floatValue() > 0.0f) {
iinput.put(entryPoint.getKey(), entryPoint.getKey());
}
}
}
}
public static void renderSection(Section section, OpenXMLDocument document) {
String title = section.getTitle();
document.appendHeading1(title, null);
......
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