Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -r73ed8a0a0d5fa96ffce05fb414831b759b9c000c -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 73ed8a0a0d5fa96ffce05fb414831b759b9c000c) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -124,8 +124,9 @@ public static final String MAP_GENERAL_SELECTED_OPTIONS_CONTENT ="mapGeneralSelectedOptionsContent"; public static final String MAP_STARTUP_GENERAL_OPTIONS_CONTENT ="mapStartupGeneralOptionsContent"; public static final String MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT ="mapStartupGeneralSelectedOptionsContent"; - public static final String MAP_STARTUP_GENERAL_OPTIONS_QUEID ="mapStartupGeneralOptionsQueId"; + public static final String LIST_GENERAL_CHECKED_OPTIONS_CONTENT ="listGeneralCheckedOptionsContent"; public static final String MAP_STUDENTS_VOTED ="mapStudentsVoted"; + public static final String QUESTIONS_WITHNO_OPTIONS ="questionsWithNoOptions"; public static final String MAP_GENERAL_CHECKED_OPTIONS_CONTENT ="mapGeneralCheckedOptionsContent"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -97,6 +97,8 @@ public void removeVoteUsrAttemptByUID(Long uid); public void removeVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt); + + public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -rf29e20502462a1c913b9fbb8da5ada07a729db04 -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision f29e20502462a1c913b9fbb8da5ada07a729db04) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -57,6 +57,8 @@ private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueContentId=:voteQueContentId"; + private static final String LOAD_ATTEMPT_FOR_USER_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId"; + private static final String LOAD_USER_ENTRIES = "select distinct voteUsrAttempt.userEntry from VoteUsrAttempt voteUsrAttempt"; private static final String LOAD_USER_ENTRY_RECORDS = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.userEntry=:userEntry and voteUsrAttempt.voteQueContentId=1 "; @@ -482,7 +484,32 @@ return null; } + public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_SESSION) + .setLong("queUsrId", queUsrId.longValue()) + .list(); + + Set userEntries= new HashSet(); + if(list != null && list.size() > 0){ + Iterator listIterator=list.iterator(); + while (listIterator.hasNext()) + { + VoteUsrAttempt attempt=(VoteUsrAttempt)listIterator.next(); + + if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) + { + userEntries.add(attempt.getVoteQueContent().getQuestion()); + } + } + } + return userEntries; + } + + + public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -rf4622422fe3e19c1205d05b4e7d90a5ab5f48cd0 -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision f4622422fe3e19c1205d05b4e7d90a5ab5f48cd0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -289,6 +289,8 @@ public List getOfflineFilesMetaData(Long voteContentId) throws VoteApplicationException; public List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException; + + public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r683ee20a2363e56d2b63c07119a79f5a1aa0377f -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 683ee20a2363e56d2b63c07119a79f5a1aa0377f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -330,7 +330,22 @@ } } + public Set getAttemptsForUserAndSession(final Long queUsrUid, final Long voteSessionUid) throws VoteApplicationException + { + try + { + return voteUsrAttemptDAO.getAttemptsForUserAndSession(queUsrUid, voteSessionUid); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is getting user entries: " + + e.getMessage(), + e); + } + + } + public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException { try Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java =================================================================== diff -u -r418f65577010d4ad648867396f4e14cd36d2c723 -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 418f65577010d4ad648867396f4e14cd36d2c723) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -135,21 +135,28 @@ setContentInUse(request); IVoteService voteService =VoteUtils.getToolService(request); - - Collection voteDisplayOrderIds = voteLearningForm.votesAsCollection(); - logger.debug("Checkbox votes "+voteDisplayOrderIds); - - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId:" + toolContentId); + + Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID); + logger.debug("toolSessionId: " + toolSessionId); - VoteContent voteContent=voteService.retrieveVote(toolContentId); - logger.debug("voteContent:" + voteContent); + VoteSession voteSession=voteService.retrieveVoteSession(toolSessionId); + logger.debug("retrieving voteSession: " + voteSession); + + Long toolSessionUid=voteSession.getUid(); + logger.debug("toolSessionUid: " + toolSessionUid); + + String userID=(String)request.getSession().getAttribute(USER_ID); + logger.debug("userID: " + userID); + VoteQueUsr existingVoteQueUsr=voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); + logger.debug("existingVoteQueUsr: " + existingVoteQueUsr); - Map mapGeneralCheckedOptionsContent = LearningUtil.buildQuestionContentMap(request, voteContent, voteDisplayOrderIds); - logger.debug("mapGeneralCheckedOptionsContent: "+ mapGeneralCheckedOptionsContent); - request.setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapGeneralCheckedOptionsContent); + List userAttempts=voteService.getAttemptsForUserAndSession(existingVoteQueUsr.getUid(), toolSessionUid); + logger.debug("userAttempts: "+ userAttempts); + request.setAttribute(LIST_GENERAL_CHECKED_OPTIONS_CONTENT, userAttempts); + voteLearningForm.resetCommands(); + logger.debug("fwding to ALL_NOMINATIONS: "+ ALL_NOMINATIONS); return (mapping.findForward(ALL_NOMINATIONS)); } @@ -445,6 +452,7 @@ // Put the map in the request ready for the next screen request.setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, mapGeneralCheckedOptionsContent); logger.debug("final mapGeneralCheckedOptionsContent: " + mapGeneralCheckedOptionsContent); + voteLearningForm.setMapGeneralCheckedOptionsContent(mapGeneralCheckedOptionsContent); voteLearningForm.setNominationsSubmited(new Boolean(true).toString()); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java =================================================================== diff -u -r659d51e5ab4c3de66bce0572d685b9ec77166895 -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java (.../VoteLearningForm.java) (revision 659d51e5ab4c3de66bce0572d685b9ec77166895) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningForm.java (.../VoteLearningForm.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -85,7 +86,10 @@ protected String maxNominationCountReached; protected int castVoteCount; - /** The check boxes selected on the first voting screen */ + protected Map mapGeneralCheckedOptionsContent; + + +/** The check boxes selected on the first voting screen */ protected String[] checkedVotes; public void reset(ActionMapping mapping, HttpServletRequest request) { @@ -640,5 +644,19 @@ public void setCheckedVotes(String[] checkedVotes) { this.checkedVotes = checkedVotes; } + + /** + * @return Returns the mapGeneralCheckedOptionsContent. + */ + public Map getMapGeneralCheckedOptionsContent() { + return mapGeneralCheckedOptionsContent; + } + /** + * @param mapGeneralCheckedOptionsContent The mapGeneralCheckedOptionsContent to set. + */ + public void setMapGeneralCheckedOptionsContent( + Map mapGeneralCheckedOptionsContent) { + this.mapGeneralCheckedOptionsContent = mapGeneralCheckedOptionsContent; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java =================================================================== diff -u -r37b0d767ea3967f19546a54e735822e3ba2b0a0e -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision 37b0d767ea3967f19546a54e735822e3ba2b0a0e) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -278,6 +278,9 @@ } voteAuthoringForm.resetUserAction(); + + if (voteAuthoringForm != null) + voteAuthoringForm.setCurrentTab("1"); logger.debug("will return to jsp with: " + sourceVoteStarter); String destination=VoteUtils.getDestination(sourceVoteStarter); Index: lams_tool_vote/web/learning/AllNominations.jsp =================================================================== diff -u -r418f65577010d4ad648867396f4e14cd36d2c723 -r96c010334a799ab269945c37537e46dd15f2a2bc --- lams_tool_vote/web/learning/AllNominations.jsp (.../AllNominations.jsp) (revision 418f65577010d4ad648867396f4e14cd36d2c723) +++ lams_tool_vote/web/learning/AllNominations.jsp (.../AllNominations.jsp) (revision 96c010334a799ab269945c37537e46dd15f2a2bc) @@ -96,10 +96,10 @@ - + - + Fisheye: Tag 96c010334a799ab269945c37537e46dd15f2a2bc refers to a dead (removed) revision in file `lams_tool_vote/web/learning/learningHeader.jsp'. Fisheye: No comparison available. Pass `N' to diff?