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

OO-3419: save the order of the answers in the KPrim editor

parent 3dae7c9c
No related branches found
No related tags found
No related merge requests found
......@@ -273,6 +273,12 @@ public class KPrimAssessmentItemBuilder extends AssessmentItemBuilder {
public List<SimpleAssociableChoice> getKprimChoices() {
return matchInteraction.getSimpleMatchSets().get(0).getSimpleAssociableChoices();
}
public void setKprimChoices(List<SimpleAssociableChoice> choices) {
SimpleMatchSet matchSet = matchInteraction.getSimpleMatchSets().get(0);
matchSet.getSimpleAssociableChoices().clear();
matchSet.getSimpleAssociableChoices().addAll(new ArrayList<>(choices));
}
@Override
protected void buildResponseAndOutcomeDeclarations() {
......
......@@ -239,6 +239,7 @@ public class KPrimEditorController extends FormBasicController {
//set associations
if(!restrictedEdit) {
List<SimpleAssociableChoice> choices = new ArrayList<>();
for(KprimWrapper choiceWrapper:choiceWrappers) {
SimpleAssociableChoice choice = choiceWrapper.getSimpleChoice();
Identifier choiceIdentifier = choice.getIdentifier();
......@@ -248,7 +249,9 @@ public class KPrimEditorController extends FormBasicController {
} else if("wrong".equals(association)) {
itemBuilder.setAssociation(choiceIdentifier, QTI21Constants.WRONG_IDENTIFIER);
}
choices.add(choice);
}
itemBuilder.setKprimChoices(choices);
}
fireEvent(ureq, new AssessmentItemEvent(AssessmentItemEvent.ASSESSMENT_ITEM_CHANGED, itemBuilder.getAssessmentItem(), QTI21QuestionType.kprim));
......
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