Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUsrAttempt.hbm.xml =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUsrAttempt.hbm.xml (.../VoteUsrAttempt.hbm.xml) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUsrAttempt.hbm.xml (.../VoteUsrAttempt.hbm.xml) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -58,17 +58,6 @@ > - - - - - - - - Index: lams_tool_vote/conf/language/ApplicationResources.properties =================================================================== diff -u -rae28185f07883077586773f760d1bde953e2d9bf -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision ae28185f07883077586773f760d1bde953e2d9bf) +++ lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -53,7 +53,9 @@ label.withoutRetries.results.summary =Voting without Retries Summary label.learning.reportMessage =The following are your votes. label.learning.reportMessage.past =The following were your votes. -error.maxNominationCount.reached =You have reached the maximum number of nominations you can select.
Please vote again. +error.maxNominationCount.reached =You have selected too many nominations. You can only select +label.nominations =nominations. + label.learning.forceFinishMessage =Voting is no more allowed. Please finish. count.total.user =Total Users Count: count.finished.user =Finished User Count: Index: lams_tool_vote/db/model/lams_tool_vote.clay =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -100,7 +100,7 @@ - + @@ -128,24 +128,11 @@ - - - - - - - - - - - - - - + @@ -201,13 +188,6 @@ - - - - - - - @@ -294,7 +274,7 @@
- + Index: lams_tool_vote/db/sql/create_lams_tool_vote.sql =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -60,7 +60,6 @@ CREATE TABLE tl_lavote11_usr_attempt ( uid BIGINT(20) NOT NULL AUTO_INCREMENT , que_usr_id BIGINT(20) NOT NULL - , vote_session_id BIGINT(20) NOT NULL , vote_nomination_content_id BIGINT(20) NOT NULL , attempt_time DATETIME , time_zone VARCHAR(255) @@ -70,9 +69,6 @@ , INDEX (que_usr_id) , CONSTRAINT FK_tl_lavote11_usr_attempt_2 FOREIGN KEY (que_usr_id) REFERENCES tl_lavote11_usr (uid) - , INDEX (vote_session_id) - , CONSTRAINT FK_tl_lavote11_usr_attempt_4 FOREIGN KEY (vote_session_id) - REFERENCES tl_lavote11_session (uid) , INDEX (vote_nomination_content_id) , CONSTRAINT FK_tl_lavote11_usr_attempt_3 FOREIGN KEY (vote_nomination_content_id) REFERENCES tl_lavote11_nomination_content (uid) @@ -90,7 +86,6 @@ REFERENCES tl_lavote11_content (uid) )TYPE=InnoDB; - INSERT INTO tl_lavote11_content(uid, content_id , title , instructions , creation_date , created_by , run_offline , define_later, offline_instructions, online_instructions, content_in_use, retries) VALUES (1, ${default_content_id} ,'Voting Title','Voting Instructions', NOW(), 1,0, 0, 'offline instructions','online instructions', 0, 0); INSERT INTO tl_lavote11_nomination_content (uid,nomination, display_order, vote_content_id) VALUES (1, 'sample nomination', 1, 1); \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -49,7 +49,7 @@ private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueContentId=:voteQueContentId"; - 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 and voteUsrAttempt.voteSessionId=:voteSessionId"; + 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_USER_ENTRIES = "select distinct voteUsrAttempt.userEntry from VoteUsrAttempt voteUsrAttempt"; @@ -106,21 +106,25 @@ public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) { - String strGetUser = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteSessionId=:voteSessionId"; + //String strGetUser = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteSessionId=:voteSessionId"; + String strGetUser = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId"; HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(strGetUser) .setLong("queUsrId", queUsrId.longValue()) - .setLong("voteSessionId", voteSessionId.longValue()) .list(); if(list != null && list.size() > 0){ Iterator listIterator=list.iterator(); while (listIterator.hasNext()) { VoteUsrAttempt attempt=(VoteUsrAttempt)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(attempt); - templ.flush(); + if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) + { + this.getSession().setFlushMode(FlushMode.AUTO); + templ.delete(attempt); + templ.flush(); + + } } } } @@ -150,20 +154,31 @@ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION) .setLong("queUsrId", queUsrId.longValue()) .setLong("voteQueContentId", voteQueContentId.longValue()) - .setLong("voteSessionId", voteSessionId.longValue()) .list(); + /* if(list != null && list.size() > 0){ VoteUsrAttempt voteA = (VoteUsrAttempt) list.get(0); return voteA; } return null; + */ + 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())) + { + return attempt; + } + } + } + return null; } - - public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java (.../VoteUsrAttempt.java) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUsrAttempt.java (.../VoteUsrAttempt.java) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -54,8 +54,6 @@ private Long queUsrId; - private Long voteSessionId; - private boolean singleUserEntry; private Long voteQueContentId; @@ -66,10 +64,7 @@ /** persistent field */ private org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr; - /** persistent field */ - private org.lamsfoundation.lams.tool.vote.pojos.VoteSession voteSession; - - + /** full constructor */ public VoteUsrAttempt(Long attemptId, Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { @@ -108,19 +103,7 @@ this.singleUserEntry=singleUserEntry; } - public VoteUsrAttempt(Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, - org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr, VoteSession voteSession, String userEntry, boolean singleUserEntry) { - this.attemptTime = attemptTime; - this.timeZone = timeZone; - this.voteQueContent = voteQueContent; - this.voteQueUsr = voteQueUsr; - this.voteSession= voteSession; - this.userEntry=userEntry; - this.singleUserEntry=singleUserEntry; - } - - public VoteUsrAttempt(String userEntry, Date attemptTime, String timeZone, org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent voteQueContent, org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr voteQueUsr) { this.userEntry=userEntry; @@ -259,29 +242,4 @@ this.singleUserEntry = singleUserEntry; } - /** - * @return Returns the voteSessionId. - */ - public Long getVoteSessionId() { - return voteSessionId; - } - /** - * @param voteSessionId The voteSessionId to set. - */ - public void setVoteSessionId(Long voteSessionId) { - this.voteSessionId = voteSessionId; - } - /** - * @return Returns the voteSession. - */ - public org.lamsfoundation.lams.tool.vote.pojos.VoteSession getVoteSession() { - return voteSession; - } - /** - * @param voteSession The voteSession to set. - */ - public void setVoteSession( - org.lamsfoundation.lams.tool.vote.pojos.VoteSession voteSession) { - this.voteSession = voteSession; - } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java (.../LearningUtil.java) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/LearningUtil.java (.../LearningUtil.java) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -193,7 +193,7 @@ else { logger.debug("create new attempt"); - VoteUsrAttempt voteUsrAttempt=new VoteUsrAttempt(attempTime, timeZone, voteQueContent, voteQueUsr, voteSession, userEntry, singleUserEntry); + VoteUsrAttempt voteUsrAttempt=new VoteUsrAttempt(attempTime, timeZone, voteQueContent, voteQueUsr, userEntry, singleUserEntry); logger.debug("voteUsrAttempt: " + voteUsrAttempt); voteService.createVoteUsrAttempt(voteUsrAttempt); logger.debug("created voteUsrAttempt in the db :" + voteUsrAttempt); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java =================================================================== diff -u -rc3d18ff9199715376d8d75d0173bbc595e53f4b5 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision c3d18ff9199715376d8d75d0173bbc595e53f4b5) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -365,20 +365,72 @@ VoteUtils.cleanUpUserExceptions(request); logger.debug("dispatching continueOptionsCombined..."); + + + + VoteLearningForm voteLearningForm = (VoteLearningForm) form; voteLearningForm.setRevisitingPageActive(new Boolean(false).toString()); voteLearningForm.setNominationsSubmited(new Boolean(false).toString()); voteLearningForm.setMaxNominationCountReached(new Boolean(false).toString()); + + Map mapGeneralCheckedOptionsContent=(Map) request.getSession().getAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT); + logger.debug("mapGeneralCheckedOptionsContent: " + mapGeneralCheckedOptionsContent); + + int castVoteCount=mapGeneralCheckedOptionsContent.size(); + logger.debug("castVoteCount pre user entry count: " + castVoteCount); + + String userEntry=voteLearningForm.getUserEntry(); + logger.debug("userEntry: " + userEntry); + + if ((userEntry != null) && (userEntry.length() > 0)) + { + logger.debug("userEntry available: " + userEntry); + ++castVoteCount; + } + logger.debug("castVoteCount post user entry count: " + castVoteCount); + + + String maxNominationCount=voteLearningForm.getMaxNominationCount(); + logger.debug("maxNominationCount: " + maxNominationCount); + + int intMaxNominationCount=0; + if (maxNominationCount != null) + intMaxNominationCount=new Integer(maxNominationCount).intValue(); + logger.debug("intMaxNominationCount: " + intMaxNominationCount); + logger.debug("intMaxNominationCount versus current voting count: " + intMaxNominationCount + " versus " + castVoteCount ); + + if (castVoteCount > intMaxNominationCount ) + { + voteLearningForm.setMaxNominationCountReached(new Boolean(true).toString()); + persistError(request, "error.maxNominationCount.reached"); + logger.debug("give warning, max nom count reached..."); + logger.debug("fwd'ing to: " + LOAD_LEARNER); + return (mapping.findForward(LOAD_LEARNER)); + } + + + + + + + + + //VoteLearningForm voteLearningForm = (VoteLearningForm) form; + //voteLearningForm.setRevisitingPageActive(new Boolean(false).toString()); + //voteLearningForm.setNominationsSubmited(new Boolean(false).toString()); + //voteLearningForm.setMaxNominationCountReached(new Boolean(false).toString()); + IVoteService voteService =VoteUtils.getToolService(request); setContentInUse(request); - Map mapGeneralCheckedOptionsContent=(Map) request.getSession().getAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT); + //Map mapGeneralCheckedOptionsContent=(Map) request.getSession().getAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT); logger.debug("final mapGeneralCheckedOptionsContent: " + mapGeneralCheckedOptionsContent); Long toolContentId=(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); logger.debug("toolContentId: " + toolContentId); - String userEntry=voteLearningForm.getUserEntry(); + //String userEntry=voteLearningForm.getUserEntry(); logger.debug("userEntry: " + userEntry); boolean userEntryAvailable=false; @@ -475,8 +527,10 @@ logger.debug("final mapGeneralCheckedOptionsContent: " + mapGeneralCheckedOptionsContent); voteLearningForm.setNominationsSubmited(new Boolean(true).toString()); - logger.debug("fwd ing to: " + ALL_NOMINATIONS); - return (mapping.findForward(ALL_NOMINATIONS)); + //logger.debug("fwd ing to: " + ALL_NOMINATIONS); + //return (mapping.findForward(ALL_NOMINATIONS)); + + return (mapping.findForward(INDIVIDUAL_REPORT)); } public ActionForward redoQuestions(ActionMapping mapping, Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java =================================================================== diff -u -rb981d563ace42f1c943a2e847aa2f725249b82a8 -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision b981d563ace42f1c943a2e847aa2f725249b82a8) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -46,6 +46,7 @@ import org.lamsfoundation.lams.tool.vote.VoteMonitoredUserDTO; import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; +import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; @@ -122,10 +123,30 @@ { logger.debug("dispatching submitSession..."); + IVoteService voteService=null; + logger.debug("will retrieve voteService"); + voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("retrieving voteService from session: " + voteService); + + if (voteService == null) + { + voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("voteService: " + voteService); + } + + VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; String currentMonitoredToolSession=voteMonitoringForm.getSelectedToolSessionId(); logger.debug("currentMonitoredToolSession: " + currentMonitoredToolSession); + VoteSession voteSession=voteService.retrieveVoteSession(new Long(currentMonitoredToolSession)); + logger.debug("retrieving voteSession: " + voteSession); + + VoteContent voteContent=voteSession.getVoteContent(); + logger.debug("using voteContent: " + voteContent); + + refreshSummaryData(request, voteContent, voteService, true, false, currentMonitoredToolSession, null, true); + if (currentMonitoredToolSession.equals("All")) { request.getSession().setAttribute(SELECTION_CASE, new Long(2)); Index: lams_tool_vote/web/learning/AnswersContent.jsp =================================================================== diff -u -rae28185f07883077586773f760d1bde953e2d9bf -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision ae28185f07883077586773f760d1bde953e2d9bf) +++ lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -50,7 +50,9 @@ @@ -165,11 +167,11 @@ Index: lams_tool_vote/web/learning/IndividualLearnerResults.jsp =================================================================== diff -u -rae28185f07883077586773f760d1bde953e2d9bf -r83ebb6f565f6d5ce638160e37fc6793c074c6356 --- lams_tool_vote/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision ae28185f07883077586773f760d1bde953e2d9bf) +++ lams_tool_vote/web/learning/IndividualLearnerResults.jsp (.../IndividualLearnerResults.jsp) (revision 83ebb6f565f6d5ce638160e37fc6793c074c6356) @@ -66,23 +66,6 @@ - - - - -       - - - - - - -       -
- + + +
- - - + + +