Index: lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McUsrAttempt.hbm.xml =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McUsrAttempt.hbm.xml (.../McUsrAttempt.hbm.xml) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McUsrAttempt.hbm.xml (.../McUsrAttempt.hbm.xml) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -49,9 +49,17 @@ column="passed" length="1" /> - - + + + + - + @@ -662,6 +662,19 @@ + + + + + + + + + + + + + Index: lams_tool_lamc/db/sql/create_lams_tool_lamc.sql =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/db/sql/create_lams_tool_lamc.sql (.../create_lams_tool_lamc.sql) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/db/sql/create_lams_tool_lamc.sql (.../create_lams_tool_lamc.sql) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -85,6 +85,7 @@ , mc_que_option_id BIGINT(20) NOT NULL , attempt_time DATETIME , time_zone VARCHAR(255) + , isAttemptCorrect TINYINT(1) NOT NULL DEFAULT 0 , mark VARCHAR(255) NOT NULL DEFAULT '0' , passed TINYINT(1) NOT NULL DEFAULT 0 , attemptOrder INTEGER NOT NULL DEFAULT 1 Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -88,8 +88,10 @@ public static final Long INITIAL_QUESTION_COUNT =new Long(1); public static final long MAX_QUESTION_COUNT =20; public static final long MAX_OPTION_COUNT =10; + public static final int MAX_ATTEMPTY_HISTORY =30; + /* * Struts level constants */ @@ -156,6 +158,8 @@ public static final String MAP_LEARNER_FEEDBACK_CORRECT ="mapLeanerFeedbackCorrect"; public static final String MAP_QUESTION_WEIGHTS ="mapQuestionWeights"; public static final String MAP_QUE_ATTEMPTS ="mapQueAttempts"; + public static final String MAP_QUE_CORRECT_ATTEMPTS ="mapQueCorrectAttempts"; + public static final String MAP_QUE_INCORRECT_ATTEMPTS ="mapQueIncorrectAttempts"; public static final String MAP_WEIGHTS ="mapWeights"; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties =================================================================== diff -u -ra5ed179d80f07ee8130b5e3364700180ddc3c6f2 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision a5ed179d80f07ee8130b5e3364700180ddc3c6f2) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -26,6 +26,7 @@ label.view.summary =View Summary label.view.answers =View Answers label.finished =Finished +label.attempt =Attempt button.basic =Basic Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java (.../McUsrAttempt.java) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -51,6 +51,8 @@ private Integer mark; + private boolean attemptCorrect; + private boolean passed; private Integer attemptOrder; @@ -110,6 +112,19 @@ this.passed = passed; this.attemptOrder=attemptOrder; } + + public McUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.mc.McQueContent mcQueContent, + org.lamsfoundation.lams.tool.mc.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.McOptsContent mcOptionsContent, Integer mark, boolean passed, Integer attemptOrder, boolean attemptCorrect) { + this.attemptTime = attemptTime; + this.timeZone = timeZone; + this.mcQueContent = mcQueContent; + this.mcQueUsr = mcQueUsr; + this.mcOptionsContent = mcOptionsContent; + this.mark = mark; + this.passed = passed; + this.attemptOrder=attemptOrder; + this.attemptCorrect=attemptCorrect; + } /** default constructor */ @@ -246,4 +261,17 @@ public void setMcQueContentId(Long mcQueContentId) { this.mcQueContentId = mcQueContentId; } + + /** + * @return Returns the attemptCorrect. + */ + public boolean isAttemptCorrect() { + return attemptCorrect; + } + /** + * @param attemptCorrect The attemptCorrect to set. + */ + public void setAttemptCorrect(boolean attemptCorrect) { + this.attemptCorrect = attemptCorrect; + } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (.../LearningUtil.java) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -512,39 +512,47 @@ * * @param request */ - public static void createAttempt(HttpServletRequest request, McQueUsr mcQueUsr, Map mapGeneralCheckedOptionsContent, int mark, boolean passed, int highestAttemptOrder) + public static void createAttempt(HttpServletRequest request, McQueUsr mcQueUsr, Map mapGeneralCheckedOptionsContent, int mark, boolean passed, int highestAttemptOrder, Map mapLeanerAssessmentResults) { IMcService mcService =McUtils.getToolService(request); Date attempTime=McUtils.getGMTDateTime(); String timeZone= McUtils.getCurrentTimeZone(); logger.debug("timeZone: " + timeZone); + Long toolContentUID= (Long) request.getSession().getAttribute(TOOL_CONTENT_UID); + logger.debug("toolContentUID: " + toolContentUID); Iterator itCheckedMap = mapGeneralCheckedOptionsContent.entrySet().iterator(); while (itCheckedMap.hasNext()) { Map.Entry checkedPairs = (Map.Entry)itCheckedMap.next(); Map mapCheckedOptions=(Map) checkedPairs.getValue(); - Long questionDisplayOrder=new Long(checkedPairs.getKey().toString()); + Long questionDisplayOrder=new Long(checkedPairs.getKey().toString()); + logger.debug("questionDisplayOrder: " + questionDisplayOrder); + String isAttemptCorrect=(String)mapLeanerAssessmentResults.get(questionDisplayOrder.toString()); + logger.debug("isAttemptCorrect: " + isAttemptCorrect); + McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(questionDisplayOrder, toolContentUID); - createIndividualOptions(request, mapCheckedOptions, mcQueContent, mcQueUsr, attempTime, timeZone, mark, passed, new Integer(highestAttemptOrder)); + createIndividualOptions(request, mapCheckedOptions, mcQueContent, mcQueUsr, attempTime, timeZone, mark, passed, new Integer(highestAttemptOrder), isAttemptCorrect); } } - public static void createIndividualOptions(HttpServletRequest request, Map mapCheckedOptions, McQueContent mcQueContent, McQueUsr mcQueUsr, Date attempTime, String timeZone, int mark, boolean passed, Integer highestAttemptOrder) + public static void createIndividualOptions(HttpServletRequest request, Map mapCheckedOptions, McQueContent mcQueContent, McQueUsr mcQueUsr, Date attempTime, String timeZone, int mark, boolean passed, Integer highestAttemptOrder, String isAttemptCorrect) { IMcService mcService =McUtils.getToolService(request); Integer IntegerMark= new Integer(mark); + logger.debug("createIndividualOptions-> isAttemptCorrect: " + isAttemptCorrect); + Iterator itCheckedMap = mapCheckedOptions.entrySet().iterator(); while (itCheckedMap.hasNext()) { Map.Entry checkedPairs = (Map.Entry)itCheckedMap.next(); McOptsContent mcOptsContent= mcService.getOptionContentByOptionText(checkedPairs.getValue().toString(), mcQueContent.getUid()); - McUsrAttempt mcUsrAttempt=new McUsrAttempt(attempTime, timeZone, mcQueContent, mcQueUsr, mcOptsContent, IntegerMark, passed, highestAttemptOrder); + McUsrAttempt mcUsrAttempt=new McUsrAttempt(attempTime, timeZone, mcQueContent, mcQueUsr, mcOptsContent, IntegerMark, passed, highestAttemptOrder, new Boolean(isAttemptCorrect).booleanValue()); mcService.createMcUsrAttempt(mcUsrAttempt); logger.debug("created mcUsrAttempt in the db :" + mcUsrAttempt); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -45,7 +45,6 @@ import org.apache.struts.action.ActionMessages; import org.apache.struts.actions.DispatchAction; import org.lamsfoundation.lams.tool.mc.McAppConstants; -import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McComparator; import org.lamsfoundation.lams.tool.mc.McContent; import org.lamsfoundation.lams.tool.mc.McOptsContent; @@ -2166,7 +2165,7 @@ logger.debug("current highestAttemptOrder:" + highestAttemptOrder); logger.debug("passed: " + passed); - LearningUtil.createAttempt(request, mcQueUsr, mapGeneralCheckedOptionsContent, mark, passed, new Integer(highestAttemptOrder).intValue()); + LearningUtil.createAttempt(request, mcQueUsr, mapGeneralCheckedOptionsContent, mark, passed, new Integer(highestAttemptOrder).intValue(), mapLeanerAssessmentResults); logger.debug("created user attempt in the db"); int intHighestAttemptOrder=new Integer(highestAttemptOrder).intValue()+ 1 ; @@ -2245,41 +2244,81 @@ logger.debug("queUsrId: " + queUsrId); Map mapQueAttempts= new TreeMap(new McComparator()); + Map mapQueCorrectAttempts= new TreeMap(new McComparator()); + Map mapQueIncorrectAttempts= new TreeMap(new McComparator()); for (int i=1; i<= new Integer(totalQuestionCount).intValue(); i++) { logger.debug("doing question with display order: " + i); McQueContent mcQueContent=mcService.getQuestionContentByDisplayOrder(new Long(i), toolContentUID); logger.debug("mcQueContent uid: " + mcQueContent.getUid()); - //List attempts=mcService.getAttemptForQueContent(queUsrId, mcQueContent.getUid()); - //logger.debug("attempts for question: " + mcQueContent.getUid() + " are: " + attempts); - + Map mapAttemptOrderAttempts= new TreeMap(new McComparator()); - for (int j=1; j < 11 ; j++ ) + Map mapAttemptOrderCorrectAttempts= new TreeMap(new McComparator()); + Map mapAttemptOrderIncorrectAttempts= new TreeMap(new McComparator()); + for (int j=1; j <= MAX_ATTEMPTY_HISTORY ; j++ ) { List attemptsByAttemptOrder=mcService.getAttemptByAttemptOrder(queUsrId, mcQueContent.getUid(), new Integer(j)); logger.debug("attemptsByAttemptOrder: " + j + " is: " + attemptsByAttemptOrder); Map mapAttempts= new TreeMap(new McComparator()); + Map mapAttemptsIncorrect= new TreeMap(new McComparator()); + Map mapAttemptsCorrect= new TreeMap(new McComparator()); Iterator attemptIterator=attemptsByAttemptOrder.iterator(); Long mapIndex=new Long(1); while (attemptIterator.hasNext()) { McUsrAttempt mcUsrAttempt=(McUsrAttempt)attemptIterator.next(); - mapAttempts.put(mapIndex.toString(),mcUsrAttempt.getMcOptionsContent().getMcQueOptionText()); + + if (mcUsrAttempt.isAttemptCorrect()) + { + mapAttemptsCorrect.put(mapIndex.toString(), mcUsrAttempt.getMcOptionsContent().getMcQueOptionText()); + } + else + { + mapAttemptsIncorrect.put(mapIndex.toString(), mcUsrAttempt.getMcOptionsContent().getMcQueOptionText()); + } + mapAttempts.put(mapIndex.toString(), mcUsrAttempt.getMcOptionsContent().getMcQueOptionText()); logger.debug("added attempt with order: " + mcUsrAttempt.getAttemptOrder() + " , option text is: " + mcUsrAttempt.getMcOptionsContent().getMcQueOptionText()); mapIndex=new Long(mapIndex.longValue()+1); } + logger.debug("final mapAttempts is: " + mapAttempts); - mapAttemptOrderAttempts.put(new Integer(j).toString(), mapAttempts); + if (mapAttempts.size() > 0) + { + mapAttemptOrderAttempts.put(new Integer(j).toString(), mapAttempts); + } + if (mapAttemptsCorrect.size() > 0) + { + mapAttemptOrderCorrectAttempts.put(new Integer(j).toString(), mapAttemptsCorrect); + } + if (mapAttemptsIncorrect.size() > 0) + { + mapAttemptOrderIncorrectAttempts.put(new Integer(j).toString(), mapAttemptsIncorrect); + } } + logger.debug("final mapAttemptOrderAttempts is: " + mapAttemptOrderAttempts); - mapQueAttempts.put(new Integer(i).toString(), mapAttemptOrderAttempts); + if (mapAttemptOrderAttempts.size() > 0) + { + mapQueAttempts.put(new Integer(i).toString(), mapAttemptOrderAttempts); + } + if (mapAttemptOrderCorrectAttempts.size() > 0) + { + mapQueCorrectAttempts.put(new Integer(i).toString(), mapAttemptOrderCorrectAttempts); + } + if (mapAttemptOrderIncorrectAttempts.size() > 0) + { + mapQueIncorrectAttempts.put(new Integer(i).toString(), mapAttemptOrderIncorrectAttempts); + } } - - logger.debug("final mapQueAttempts is: " + mapQueAttempts); request.getSession().setAttribute(MAP_QUE_ATTEMPTS, mapQueAttempts); + request.getSession().setAttribute(MAP_QUE_CORRECT_ATTEMPTS, mapQueCorrectAttempts); + request.getSession().setAttribute(MAP_QUE_INCORRECT_ATTEMPTS, mapQueIncorrectAttempts); + logger.debug("final mapQueAttempts is: " + mapQueAttempts); + logger.debug("final mapQueCorrectAttempts is: " + mapQueCorrectAttempts); + logger.debug("final mapQueIncorrectAttempts is: " + mapQueIncorrectAttempts); mcLearningForm.resetCommands(); return (mapping.findForward(VIEW_ANSWERS)); } Index: lams_tool_lamc/web/ViewAnswers.jsp =================================================================== diff -u -r43b99721a0fa18b4ee65f3e94caf81cc7782ce87 -r6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6 --- lams_tool_lamc/web/ViewAnswers.jsp (.../ViewAnswers.jsp) (revision 43b99721a0fa18b4ee65f3e94caf81cc7782ce87) +++ lams_tool_lamc/web/ViewAnswers.jsp (.../ViewAnswers.jsp) (revision 6f1188b57dfc1cd53bfbeb95fcdb295f1d2bf2e6) @@ -70,27 +70,31 @@ - - - +
- - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - + + +
+ : + + +