Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r22789974b076931e27e1e37ed7d91bd17f4f9cb6 -r5534ee285138a23ab091f9799228254e3459ea8c --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 22789974b076931e27e1e37ed7d91bd17f4f9cb6) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) @@ -50,6 +50,8 @@ public int getAllEntriesCount(); + public int getUserEnteredVotesCountForContent(final Long voteContentUid); + public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid); public List getSessionUserEntries(final Long voteSessionUid); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -rca5e8fafb4ef5006a3acbf41c7fa88e94037a9a4 -r5534ee285138a23ab091f9799228254e3459ea8c --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision ca5e8fafb4ef5006a3acbf41c7fa88e94037a9a4) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) @@ -142,7 +142,31 @@ } + public int getUserEnteredVotesCountForContent(final Long voteContentUid) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(LOAD_ALL_ENTRIES) + .list(); + + int count=0; + Iterator listIterator=list.iterator(); + logger.debug("looking for voteContentUid: " + voteContentUid); + while (listIterator.hasNext()) + { + VoteUsrAttempt attempt=(VoteUsrAttempt)listIterator.next(); + logger.debug("attempt: " + attempt); + + if (attempt.getVoteQueUsr().getVoteSession().getVoteContent().getUid().toString().equals(voteContentUid.toString())) + { + ++count; + } + } + + return count; + } + + public Set getUserEntries() { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r22789974b076931e27e1e37ed7d91bd17f4f9cb6 -r5534ee285138a23ab091f9799228254e3459ea8c --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 22789974b076931e27e1e37ed7d91bd17f4f9cb6) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) @@ -97,6 +97,8 @@ public int getAttemptsForQuestionContent(final Long voteQueContentId) throws VoteApplicationException; + public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException; + public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId) throws VoteApplicationException; public int getAllEntriesCount() throws VoteApplicationException; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -rb7149ecd0947dc6187b527c725ab2f4b6503f375 -r5534ee285138a23ab091f9799228254e3459ea8c --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision b7149ecd0947dc6187b527c725ab2f4b6503f375) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) @@ -798,6 +798,22 @@ } } + + public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException + { + try + { + return voteUsrAttemptDAO.getUserEnteredVotesCountForContent(voteContentUid); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is getting the user entered votes count:" + + e.getMessage(), + e); + } + + } + public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException { @@ -1259,21 +1275,34 @@ */ public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException { + logger.debug("voteContent uid: " + voteContent.getUid()); Iterator questionIterator=voteContent.getVoteQueContents().iterator(); + + boolean activityOccurred=false; while (questionIterator.hasNext()) { VoteQueContent voteQueContent=(VoteQueContent)questionIterator.next(); Iterator attemptsIterator=voteQueContent.getVoteUsrAttempts().iterator(); while (attemptsIterator.hasNext()) { - logger.debug("there is at least one attempt"); + logger.debug("there is at least one attempt for the standard nominamtions"); /** * proved the fact that there is at least one attempt for this content. */ - return true; + activityOccurred=true; } } - logger.debug("there is no response for this content"); + + logger.debug("activityOccurred: " + activityOccurred); + int userEnteredVotesCount=getUserEnteredVotesCountForContent(voteContent.getUid()); + logger.debug("userEnteredVotesCount: " + userEnteredVotesCount); + + if ((activityOccurred == true) || (userEnteredVotesCount > 0)) + { + return true; + } + + logger.debug("there is no votes/nominations for this content"); return false; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java =================================================================== diff -u -r22789974b076931e27e1e37ed7d91bd17f4f9cb6 -r5534ee285138a23ab091f9799228254e3459ea8c --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 22789974b076931e27e1e37ed7d91bd17f4f9cb6) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 5534ee285138a23ab091f9799228254e3459ea8c) @@ -186,6 +186,7 @@ } + logger.debug("checking student activity on the standard nominations:" + voteContent); if (voteService.studentActivityOccurredGlobal(voteContent)) { VoteUtils.cleanUpSessionAbsolute(request);