Index: lams_tool_vote/conf/language/ApplicationResources.properties =================================================================== diff -u -r55e015221d64f87ca024dd967925bd763dceafd0 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 55e015221d64f87ca024dd967925bd763dceafd0) +++ lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -34,7 +34,7 @@ label.authoring.instructions =Instructions label.moveDown =Down label.other =Other -label.view.chart =View Chart (All Votes) +label.view.chart =View Session Votes Chart button.delete =Delete label.fileContent =File Content label.learning.reportMessage =The following are your votes. Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r714df94653eb0195275d4086ece5b856c3a632c3 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 714df94653eb0195275d4086ece5b856c3a632c3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -45,7 +45,7 @@ public List getUserRecords(final String userEntry); - public List getUserEntries(); + public Set getUserEntries(); public int getAllEntriesCount(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -r714df94653eb0195275d4086ece5b856c3a632c3 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 714df94653eb0195275d4086ece5b856c3a632c3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -87,12 +87,26 @@ return list; } - public List getUserEntries() + public Set getUserEntries() { HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(LOAD_USER_ENTRIES) .list(); - return list; + + Set set= new HashSet(); + + Set userEntries= new HashSet(); + if(list != null && list.size() > 0){ + Iterator listIterator=list.iterator(); + while (listIterator.hasNext()) + { + String entry=(String)listIterator.next(); + logger.debug("entry: " + entry); + if ((entry != null) && (entry.length() > 0)) + userEntries.add(entry); + } + } + return userEntries; } @@ -111,7 +125,8 @@ logger.debug("attempt: " + attempt); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { - sessionUserEntries.add(attempt.getUserEntry()); + if ((attempt.getUserEntry() != null) && (attempt.getUserEntry().length() > 0)) + sessionUserEntries.add(attempt.getUserEntry()); } } } @@ -129,6 +144,7 @@ if(list != null && list.size() > 0){ return list.size(); } + return 0; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r714df94653eb0195275d4086ece5b856c3a632c3 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 714df94653eb0195275d4086ece5b856c3a632c3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -115,7 +115,7 @@ public void cleanAllQuestions(final Long mcContentUid) throws VoteApplicationException; - public List getUserEntries() throws VoteApplicationException; + public Set getUserEntries() throws VoteApplicationException; public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, IVoteService voteService) throws VoteApplicationException; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r714df94653eb0195275d4086ece5b856c3a632c3 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 714df94653eb0195275d4086ece5b856c3a632c3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -234,7 +234,7 @@ } - public List getUserEntries() throws VoteApplicationException + public Set getUserEntries() throws VoteApplicationException { try { Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java =================================================================== diff -u -r714df94653eb0195275d4086ece5b856c3a632c3 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 714df94653eb0195275d4086ece5b856c3a632c3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -592,17 +592,27 @@ Map mapVoteRatesContent= new TreeMap(new VoteComparator()); logger.debug("mapVoteRatesContent: " + mapVoteRatesContent); - //int allEntriesCount=voteService.getAllEntriesCount(); - //logger.debug("allEntriesCount: " + allEntriesCount); - int sessionEntriesCount=voteService.getSessionEntriesCount(toolSessionUid); - logger.debug("sessionEntriesCount: " + sessionEntriesCount); - - //List userEntries=voteService.getUserEntries(); - //logger.debug("userEntries: " + userEntries); + boolean sessionLevelCharting=true; + int entriesCount=0; + Set userEntries=null; + if (toolSessionUid != null) + { + logger.debug("process for session: " + toolSessionUid); + entriesCount=voteService.getSessionEntriesCount(toolSessionUid); + userEntries=voteService.getSessionUserEntries(toolSessionUid); + } + else + { + sessionLevelCharting=false; + logger.debug("process for content: "); + entriesCount=voteService.getAllEntriesCount(); + userEntries=voteService.getUserEntries(); + } + logger.debug("entriesCount: " + entriesCount); + logger.debug("userEntries: " + userEntries); + logger.debug("sessionLevelCharting: " + sessionLevelCharting); - Set sessionUserEntries=voteService.getSessionUserEntries(toolSessionUid); - logger.debug("sessionUserEntries: " + sessionUserEntries); logger.debug("setting existing content data from the db"); mapOptionsContent.clear(); @@ -620,15 +630,26 @@ //int votesCount=voteService.getAttemptsForQuestionContent(voteQueContent.getUid()); //logger.debug("votesCount for questionContent uid: " + votesCount + " for" + voteQueContent.getUid()); - int votesCount=voteService.getAttemptsForQuestionContentAndSessionUid(voteQueContent.getUid(), toolSessionUid); - logger.debug("votesCount for questionContent uid: " + votesCount + " for" + voteQueContent.getUid()); - + int votesCount=0; + if (sessionLevelCharting == true) + { + logger.debug("getting votesCount based on session: " + toolSessionUid); + votesCount=voteService.getAttemptsForQuestionContentAndSessionUid(voteQueContent.getUid(), toolSessionUid); + logger.debug("votesCount for questionContent uid: " + votesCount + " for" + voteQueContent.getUid()); + } + else + { + logger.debug("getting votesCount based on content: " + voteQueContent.getUid()); + votesCount=voteService.getAttemptsForQuestionContent(voteQueContent.getUid()); + logger.debug("votesCount for questionContent uid: " + votesCount + " for" + voteQueContent.getUid()); + } double voteRate=0d; - if (sessionEntriesCount != 0) + if (entriesCount != 0) { - voteRate=((votesCount * 100)/ sessionEntriesCount); + voteRate=((votesCount * 100)/ entriesCount); } + logger.debug("voteRate" + voteRate); mapVoteRatesContent.put(mapIndex.toString(), new Double(voteRate).toString()); @@ -647,7 +668,7 @@ } logger.debug("Map initialized with existing contentid to: " + mapOptionsContent); - Iterator itListQuestions = sessionUserEntries.iterator(); + Iterator itListQuestions = userEntries.iterator(); int mapVoteRatesSize=mapVoteRatesContent.size(); logger.debug("mapVoteRatesSize: " + mapVoteRatesSize); mapIndex=new Long(mapVoteRatesSize+1); @@ -666,17 +687,27 @@ if ((userEntry != null) && (userEntry.length() > 0)) { - //int userEntryRate=voteService.getUserRecordsEntryCount(userEntry); - int userEntryRate=voteService.getSessionUserRecordsEntryCount(userEntry, toolSessionUid,voteService); + int userEntryRate=0; + if (sessionLevelCharting == true) + { + logger.debug("getting total for userEntryRate based on session: " + toolSessionUid); + userEntryRate=voteService.getSessionUserRecordsEntryCount(userEntry, toolSessionUid,voteService); + } + else + { + logger.debug("getting total for userEntryRate based on content: "); + userEntryRate=voteService.getUserRecordsEntryCount(userEntry); + } + logger.debug("userEntryRate: " + userEntryRate); totalUserRate=totalUserRate + userEntryRate; } } logger.debug("totalUserRate: " + totalUserRate); - itListQuestions = sessionUserEntries.iterator(); + itListQuestions = userEntries.iterator(); while (itListQuestions.hasNext()) { String userEntry =(String)itListQuestions.next(); @@ -686,9 +717,19 @@ if ((userEntry != null) && (userEntry.length() > 0)) { - int userEntryRate=voteService.getSessionUserRecordsEntryCount(userEntry, toolSessionUid,voteService); + int userEntryRate=0; + if (sessionLevelCharting == true) + { + logger.debug("getting userEntryRate based on session: " + toolSessionUid); + userEntryRate=voteService.getSessionUserRecordsEntryCount(userEntry, toolSessionUid,voteService); + } + else + { + logger.debug("getting userEntryRate based on session: " + toolSessionUid); + userEntryRate=voteService.getUserRecordsEntryCount(userEntry); + } logger.debug("userEntryRate: " + userEntryRate); - + double votesShare= (userEntryRate * share) / totalUserRate ; logger.debug("votesShare: " + votesShare); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteChartGenerator.java =================================================================== diff -u -r2be43d0e5d701ff9c00b32c85e0d35f3367d52cb -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteChartGenerator.java (.../VoteChartGenerator.java) (revision 2be43d0e5d701ff9c00b32c85e0d35f3367d52cb) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteChartGenerator.java (.../VoteChartGenerator.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -113,7 +113,7 @@ data.setValue(pairs.getValue().toString(), new Double(voteRate)); } - JFreeChart chart=ChartFactory.createPieChart("All Votes Chart", data, true, true, false); + JFreeChart chart=ChartFactory.createPieChart("Session Votes Chart", data, true, true, false); return chart; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java =================================================================== diff -u -r55e015221d64f87ca024dd967925bd763dceafd0 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 55e015221d64f87ca024dd967925bd763dceafd0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -27,6 +27,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -139,8 +140,9 @@ String currentMonitoredToolSession=voteMonitoringForm.getSelectedToolSessionId(); logger.debug("currentMonitoredToolSession: " + currentMonitoredToolSession); - - /* SELECTION_CASE == 1 indicates a selected group other than "All" */ + + + /* SELECTION_CASE == 1 indicates a selected group other than "All" */ if (currentMonitoredToolSession.equals("All")) { request.getSession().setAttribute(SELECTION_CASE, new Long(2)); @@ -152,6 +154,10 @@ VoteContent voteContent=voteSession.getVoteContent(); logger.debug("using voteContent: " + voteContent); + + logger.debug("preparing chart data for content id: " + voteContent.getVoteContentId()); + logger.debug("preparing chart data for currentMonitoredToolSession: " + currentMonitoredToolSession); + MonitoringUtil.prepareChartData(request, voteService, voteContent.getVoteContentId(), new Long(currentMonitoredToolSession)); refreshSummaryData(request, voteContent, voteService, true, false, currentMonitoredToolSession, null, true); request.getSession().setAttribute(SELECTION_CASE, new Long(1)); @@ -241,7 +247,7 @@ logger.debug("start getting user entries, showUserEntriesByUserId: " + showUserEntriesByUserId); logger.debug("start getting user entries, userId: " + userId); - List userEntries=voteService.getUserEntries(); + Set userEntries=voteService.getUserEntries(); logger.debug("userEntries: " + userEntries); List listUserEntries=new LinkedList(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java =================================================================== diff -u -r714df94653eb0195275d4086ece5b856c3a632c3 -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 714df94653eb0195275d4086ece5b856c3a632c3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -97,7 +97,7 @@ logger.debug("toolContentId: " + toolContentId); logger.debug("calling prepareChartData: " + toolContentId); - //MonitoringUtil.prepareChartData(request, voteService, toolContentId); + //MonitoringUtil.prepareChartData(request, voteService, toolContentId, null); VoteContent voteContent=voteService.retrieveVote(toolContentId); int allUserEntriesCount=voteService.getAllEntriesCount(); Index: lams_tool_vote/web/monitoring/SummaryContent.jsp =================================================================== diff -u -r2070d2357f0a24361bf0728cb9eab32d6a04c44d -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 --- lams_tool_vote/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 2070d2357f0a24361bf0728cb9eab32d6a04c44d) +++ lams_tool_vote/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950) @@ -49,20 +49,22 @@ + + - - - - - + + + + +
- - - - - - -
+ + + + + + +