Index: lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McUsrAttempt.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/Attic/McUsrAttempt.hbm.xml,v diff -u -r1.11 -r1.12 --- lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McUsrAttempt.hbm.xml 22 Nov 2005 12:55:45 -0000 1.11 +++ lams_tool_lamc/conf/hibernate/mappings/org/lamsfoundation/lams/tool/mc/McUsrAttempt.hbm.xml 22 Nov 2005 15:36:04 -0000 1.12 @@ -49,9 +49,17 @@ column="passed" length="1" /> - - + + + + - + @@ -662,6 +662,19 @@ + + + + + + + + + + + + + Index: lams_tool_lamc/db/sql/create_lams_tool_lamc.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/db/sql/Attic/create_lams_tool_lamc.sql,v diff -u -r1.20 -r1.21 Binary files differ Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java,v diff -u -r1.39 -r1.40 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java 22 Nov 2005 12:55:45 -0000 1.39 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java 22 Nov 2005 15:36:03 -0000 1.40 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Attic/McResources.properties,v diff -u -r1.32 -r1.33 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties 21 Nov 2005 13:30:28 -0000 1.32 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties 22 Nov 2005 15:36:03 -0000 1.33 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Attic/McUsrAttempt.java,v diff -u -r1.11 -r1.12 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java 22 Nov 2005 12:54:37 -0000 1.11 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUsrAttempt.java 22 Nov 2005 15:36:03 -0000 1.12 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java,v diff -u -r1.7 -r1.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 22 Nov 2005 12:55:45 -0000 1.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 22 Nov 2005 15:36:03 -0000 1.8 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java,v diff -u -r1.62 -r1.63 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 22 Nov 2005 12:55:45 -0000 1.62 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 22 Nov 2005 15:36:03 -0000 1.63 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/ViewAnswers.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_lamc/web/ViewAnswers.jsp 22 Nov 2005 12:55:45 -0000 1.1 +++ lams_tool_lamc/web/ViewAnswers.jsp 22 Nov 2005 15:36:04 -0000 1.2 @@ -70,27 +70,31 @@ - - - - - - - - - - - + + + + + + + + + : + + + + + + + + + + - - - - - + + + - - - +