Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== diff -u -r24ca84b9e61b98c068eaa369cb194a35e5511162 -r1e2a836adc83be3b0b4235d0ecddd4afaa95da2e --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 24ca84b9e61b98c068eaa369cb194a35e5511162) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 1e2a836adc83be3b0b4235d0ecddd4afaa95da2e) @@ -2059,21 +2059,21 @@ Date now = new Date(); QaContent toolContentObj = new QaContent(); - toolContentObj.setContentLocked(Boolean.FALSE); + toolContentObj.setContentLocked(Boolean.FALSE.booleanValue() ); toolContentObj.setCreatedBy(user.getUserID().longValue()); toolContentObj.setCreationDate(now); - toolContentObj.setDefineLater(Boolean.FALSE); + toolContentObj.setDefineLater(Boolean.FALSE.booleanValue()); toolContentObj.setInstructions(null); toolContentObj.setOfflineInstructions(null); toolContentObj.setOnlineInstructions(null); // TODO add reflection //toolContentObj.setReflectInstructions(null); //toolContentObj.setReflectOnActivity(Boolean.FALSE); - toolContentObj.setRunOffline(Boolean.FALSE); + toolContentObj.setRunOffline(Boolean.FALSE.booleanValue()); toolContentObj.setTitle((String)importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); toolContentObj.setQaContentId(toolContentId); toolContentObj.setUpdateDate(now); - toolContentObj.setQuestionsSequenced(Boolean.FALSE); // there is only 1 question + toolContentObj.setQuestionsSequenced(Boolean.FALSE.booleanValue()); // there is only 1 question toolContentObj.setContent(null); toolContentObj.setReportTitle(null); toolContentObj.setMonitoringReportTitle(null); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java =================================================================== diff -u -r823871bf3fd2d695c40bc974a24e66b4100d731b -r1e2a836adc83be3b0b4235d0ecddd4afaa95da2e --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 823871bf3fd2d695c40bc974a24e66b4100d731b) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 1e2a836adc83be3b0b4235d0ecddd4afaa95da2e) @@ -261,7 +261,7 @@ GeneralLearnerFlowDTO generalLearnerFlowDTO= LearningUtil.buildGeneralLearnerFlowDTO(qaContent); logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); - Map mapQuestions= new TreeMap(new QaComparator()); + Map mapQuestions= new TreeMap(new QaComparator()); Map mapAnswers= new TreeMap(new QaComparator()); generalLearnerFlowDTO.setCurrentQuestionIndex(new Integer(1)); @@ -358,7 +358,14 @@ generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions); generalLearnerFlowDTO.setMapQuestions(mapQuestions); logger.debug("mapQuestions has : " + mapQuestions.size() + " entries."); - + + if (mapAnswers != null) + { + String currentAnswer=(String)mapAnswers.get("1"); + logger.debug("first entry as the current answer : " + currentAnswer); + generalLearnerFlowDTO.setCurrentAnswer(currentAnswer); + } + generalLearnerFlowDTO.setTotalQuestionCount(new Integer(mapQuestions.size())); qaLearningForm.setTotalQuestionCount(new Integer(mapQuestions.size()).toString()); @@ -503,6 +510,8 @@ populateAnswersMap(qaLearningForm, request, generalLearnerFlowDTO, true, false); + + return (mapping.findForward(LOAD_LEARNER)); } @@ -527,6 +536,12 @@ String currentQuestionIndex=qaLearningForm.getCurrentQuestionIndex(); logger.debug("currentQuestionIndex:" + currentQuestionIndex); + Map mapAnswers=(Map)sessionMap.get(MAP_ALL_RESULTS_KEY); + logger.debug("mapAnswers retrieved: " + mapAnswers); + + if (mapAnswers == null) + mapAnswers= new TreeMap(new QaComparator()); + logger.debug("getting answer for question: " + currentQuestionIndex + "as: " + qaLearningForm.getAnswer()); logger.debug("mapSequentialAnswers size:" + mapSequentialAnswers.size()); @@ -541,6 +556,16 @@ logger.debug("adding new answer:" + qaLearningForm.getAnswer() + " to mapSequentialAnswers."); logger.debug("updated mapSequentialAnswers:" + mapSequentialAnswers); + + mapAnswers.put(currentQuestionIndex, qaLearningForm.getAnswer()); + logger.debug("updated mapAnswers:" + mapAnswers); + + sessionMap.put(MAP_ALL_RESULTS_KEY, mapAnswers); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + qaLearningForm.setHttpSessionID(sessionMap.getSessionID()); + generalLearnerFlowDTO.setHttpSessionID(sessionMap.getSessionID()); + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + int intCurrentQuestionIndex=new Integer(currentQuestionIndex).intValue(); logger.debug("intCurrentQuestionIndex:" + intCurrentQuestionIndex); @@ -555,9 +580,10 @@ logger.debug("current map size:" + mapSequentialAnswers.size()); String currentAnswer=""; - if (mapSequentialAnswers.size() >= intCurrentQuestionIndex) + if (mapAnswers.size() >= intCurrentQuestionIndex) { - currentAnswer=(String)mapSequentialAnswers.get(new Long(intCurrentQuestionIndex).toString()); + currentAnswer=(String)mapAnswers.get(new Long(intCurrentQuestionIndex).toString()); + logger.debug("currentAnswer:" + currentAnswer); } logger.debug("currentAnswer:" + currentAnswer); generalLearnerFlowDTO.setCurrentAnswer(currentAnswer);