Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java,v diff -u -r1.18 -r1.19 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java 23 May 2006 12:48:52 -0000 1.18 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java 24 May 2006 06:57:01 -0000 1.19 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java,v diff -u -r1.23 -r1.24 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 22 May 2006 14:41:32 -0000 1.23 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 24 May 2006 06:57:01 -0000 1.24 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java,v diff -u -r1.25 -r1.26 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java 23 May 2006 12:48:53 -0000 1.25 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java 24 May 2006 06:57:01 -0000 1.26 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java,v diff -u -r1.26 -r1.27 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 24 May 2006 02:11:03 -0000 1.26 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 24 May 2006 06:57:01 -0000 1.27 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java,v diff -u -r1.19 -r1.20 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java 23 May 2006 12:48:52 -0000 1.19 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java 24 May 2006 06:57:01 -0000 1.20 @@ -186,6 +186,7 @@ } + logger.debug("checking student activity on the standard nominations:" + voteContent); if (voteService.studentActivityOccurredGlobal(voteContent)) { VoteUtils.cleanUpSessionAbsolute(request);