--- a/sam/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/DeliveryActionListener.java +++ b/sam/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/DeliveryActionListener.java @@ -1275,7 +1275,7 @@ public class DeliveryActionListener } Collections.shuffle(shuffled, - new Random( (long) item.getText().hashCode() + (getAgentString() + "_" + item.getItemId().toString()).hashCode())); + new Random( (long) item.getText().hashCode() + (agentString + "_" + item.getItemId().toString()).hashCode())); /* if (item.getTypeId().equals(TypeIfc.MATCHING)) { @@ -1518,8 +1518,19 @@ public class DeliveryActionListener if (item.getTypeId().equals(TypeIfc.MATCHING)) // matching { - populateMatching(item, itemBean, publishedAnswerHash); + // Show the answers in the same order that student did. + String agentString = ""; + if (delivery.getActionMode() == DeliveryBean.GRADE_ASSESSMENT) { + StudentScoresBean studentscorebean = (StudentScoresBean) ContextUtil + .lookupBean("studentScores"); + agentString = studentscorebean.getStudentId(); + } + else { + agentString = getAgentString(); + } + + populateMatching(item, itemBean, publishedAnswerHash, agentString); } else if (item.getTypeId().equals(TypeIfc.FILL_IN_BLANK)) // fill in the blank { @@ -1549,7 +1560,7 @@ public class DeliveryActionListener return itemBean; } - public void populateMatching(ItemDataIfc item, ItemContentsBean bean, HashMap publishedAnswerHash) + public void populateMatching(ItemDataIfc item, ItemContentsBean bean, HashMap publishedAnswerHash, String agentString) { // used only for questions with distractors where the user has selected None of the Above final Long NONE_OF_THE_ABOVE = -1l; @@ -1575,9 +1586,10 @@ public class DeliveryActionListener shuffled.add(iter2.next()); } + Collections.shuffle(shuffled, new Random( (long) item.getText().hashCode() + - (getAgentString() + "_" + item.getItemId().toString()).hashCode())); + (agentString + "_" + item.getItemId().toString()).hashCode())); /* Collections.shuffle