Index: lams_tool_vote/conf/language/ApplicationResources.properties
===================================================================
diff -u -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950)
+++ lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -80,6 +80,7 @@
error.maxNominationCount.invalid =Please correct this: The "Max Nominations" field in Advanced section is invalid.
error.default.content.notSetup =The tool initialization error: The tool default content has not been set up properly.
error.question.empty =Please correct this: The question text can not be empty.
+error.fields.mandatory =Please correct this: The fields "Title", "Instructions" and the "Nomination 1" are mandatory.
error.title =Please correct this: The field "Title" is mandatory.
error.instructions =Please correct this: The field "Instructions" is mandatory.
error.learner.userId.required =Tool Activity Error! Can't continue. Tool Activity expects learner's user id.
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java
===================================================================
diff -u -r55e015221d64f87ca024dd967925bd763dceafd0 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 55e015221d64f87ca024dd967925bd763dceafd0)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -222,6 +222,7 @@
public static final String SUMMARY_TOOL_SESSIONS_ID ="summaryToolSessionsId";
public static final String MONITORED_CONTENT_ID ="monitoredContentId";
public static final String EDITACTIVITY_EDITMODE ="editActivityEditMode";
+ public static final String VALIDATION_ERROR ="validationError";
public static final String FORM_INDEX ="formIndex";
public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession";
public static final String SELECTION_CASE ="selectionCase";
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java
===================================================================
diff -u -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -110,6 +110,44 @@
}
+ public Set getUserEntriesByContentId(final Long voteQueContentId)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_USER_ENTRIES)
+ .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);
+ }
+ }
+
+ Set contentEntries= new HashSet();
+ if(userEntries != null && userEntries.size() > 0){
+ Iterator setIterator=userEntries.iterator();
+ while (setIterator.hasNext())
+ {
+ String entry=(String)setIterator.next();
+ logger.debug("entry: " + entry);
+ if ((entry != null) && (entry.length() > 0))
+
+ contentEntries.add(entry);
+ }
+ }
+
+ return userEntries;
+ }
+
+
+
public Set getSessionUserEntries(final Long voteSessionUid)
{
HibernateTemplate templ = this.getHibernateTemplate();
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java
===================================================================
diff -u -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -53,17 +53,17 @@
{
public void configureContentRepository() throws VoteApplicationException;
- public void createVote(VoteContent mcContent) throws VoteApplicationException;
+ public void createVote(VoteContent voteContent) throws VoteApplicationException;
public VoteContent retrieveVote(Long toolContentId) throws VoteApplicationException;
- public void createVoteQue(VoteQueContent mcQueContent) throws VoteApplicationException;
+ public void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException;
- public void createVoteSession(VoteSession mcSession) throws VoteApplicationException;
+ public void createVoteSession(VoteSession voteSession) throws VoteApplicationException;
- public void createVoteQueUsr(VoteQueUsr mcQueUsr) throws VoteApplicationException;
+ public void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException;
- public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long mcSessionId) throws VoteApplicationException;
+ public VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException;
public VoteQueUsr retrieveVoteQueUsr(Long userId) throws VoteApplicationException;
@@ -73,9 +73,9 @@
public int getLastNominationCount(Long userId) throws VoteApplicationException;
- public void createVoteUsrAttempt(VoteUsrAttempt mcUsrAttempt) throws VoteApplicationException;
+ public void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
- public void updateVoteUsrAttempt(VoteUsrAttempt mcUsrAttempt) throws VoteApplicationException;
+ public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
public List getUserRecords(final String userEntry) throws VoteApplicationException;
@@ -101,27 +101,27 @@
public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException;
- public void removeVoteQueContent(VoteQueContent mcQueContent) throws VoteApplicationException;
+ public void removeVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException;
public VoteQueContent getVoteQueContentByUID(Long uid) throws VoteApplicationException;
- public void saveOrUpdateVoteQueContent(VoteQueContent mcQueContent) throws VoteApplicationException;
+ public void saveOrUpdateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException;
- public void removeQuestionContentByVoteUid(final Long mcContentUid) throws VoteApplicationException;
+ public void removeQuestionContentByVoteUid(final Long voteContentUid) throws VoteApplicationException;
- public void cleanAllQuestionsSimple(final Long mcContentUid) throws VoteApplicationException;
+ public void cleanAllQuestionsSimple(final Long voteContentUid) throws VoteApplicationException;
- public void resetAllQuestions(final Long mcContentUid) throws VoteApplicationException;
+ public void resetAllQuestions(final Long voteContentUid) throws VoteApplicationException;
- public void cleanAllQuestions(final Long mcContentUid) throws VoteApplicationException;
+ public void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException;
public Set getUserEntries() throws VoteApplicationException;
public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, IVoteService voteService) throws VoteApplicationException;
public Set getSessionUserEntries(final Long voteSessionId) throws VoteApplicationException;
- public VoteQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid);
+ public VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentUid);
public void removeVoteQueContentByUID(Long uid) throws VoteApplicationException;
@@ -131,47 +131,47 @@
public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException;
- public List getAllQuestionEntries(final Long mcContentId) throws VoteApplicationException;
+ public List getAllQuestionEntries(final Long voteContentId) throws VoteApplicationException;
public VoteQueUsr getVoteQueUsrById(long voteQueUsrId) throws VoteApplicationException;
- public VoteSession retrieveVoteSession(Long mcSessionId) throws VoteApplicationException;
+ public VoteSession retrieveVoteSession(Long voteSessionId) throws VoteApplicationException;
- public VoteContent retrieveVoteBySessionId(Long mcSessionId) throws VoteApplicationException;
+ public VoteContent retrieveVoteBySessionId(Long voteSessionId) throws VoteApplicationException;
- public void updateVote(VoteContent mc) throws VoteApplicationException;
+ public void updateVote(VoteContent vote) throws VoteApplicationException;
- public void updateVoteSession(VoteSession mcSession) throws VoteApplicationException;
+ public void updateVoteSession(VoteSession voteSession) throws VoteApplicationException;
- public List getVoteUserBySessionOnly(final VoteSession mcSession) throws VoteApplicationException;
+ public List getVoteUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException;
public VoteSession getVoteSessionByUID(Long uid) throws VoteApplicationException;
- public void deleteVote(VoteContent mc) throws VoteApplicationException;
+ public void deleteVote(VoteContent vote) throws VoteApplicationException;
- public void deleteVoteById(Long mcId) throws VoteApplicationException;
+ public void deleteVoteById(Long voteId) throws VoteApplicationException;
- public void deleteVoteSession(VoteSession mcSession) throws VoteApplicationException;
+ public void deleteVoteSession(VoteSession voteSession) throws VoteApplicationException;
- public List getSessionNamesFromContent(VoteContent mcContent) throws VoteApplicationException;
+ public List getSessionNamesFromContent(VoteContent voteContent) throws VoteApplicationException;
public void removeAttempt (VoteUsrAttempt attempt) throws VoteApplicationException;
- public void deleteVoteQueUsr(VoteQueUsr mcQueUsr) throws VoteApplicationException;
+ public void deleteVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException;
public User getCurrentUserData(String username) throws VoteApplicationException;
public int getTotalNumberOfUsers() throws VoteApplicationException;
public Lesson getCurrentLesson(long lessonId) throws VoteApplicationException;
- public void saveVoteContent(VoteContent mc) throws VoteApplicationException;
+ public void saveVoteContent(VoteContent vote) throws VoteApplicationException;
- public boolean studentActivityOccurredGlobal(VoteContent mcContent) throws VoteApplicationException;
+ public boolean studentActivityOccurredGlobal(VoteContent voteContent) throws VoteApplicationException;
- public int countIncompleteSession(VoteContent mc) throws VoteApplicationException;
+ public int countIncompleteSession(VoteContent vote) throws VoteApplicationException;
- public boolean studentActivityOccurred(VoteContent mc) throws VoteApplicationException;
+ public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException;
public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException;
@@ -199,7 +199,7 @@
public VoteQueContent getToolDefaultQuestionContent(long contentId) throws VoteApplicationException;
- public List getToolSessionsForContent(VoteContent mc);
+ public List getToolSessionsForContent(VoteContent vote);
public ITicket getRepositoryLoginTicket() throws VoteApplicationException;
@@ -211,47 +211,47 @@
public String getFileUuid(String filename) throws VoteApplicationException;
- public List retrieveVoteUploadedOfflineFilesUuid(Long mcContentId) throws VoteApplicationException;
+ public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) throws VoteApplicationException;
- public List retrieveVoteUploadedOnlineFilesUuid(Long mcContentId) throws VoteApplicationException;
+ public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) throws VoteApplicationException;
- public List retrieveVoteUploadedOfflineFilesName(Long mcContentId) throws VoteApplicationException;
+ public List retrieveVoteUploadedOfflineFilesName(Long voteContentId) throws VoteApplicationException;
- public List retrieveVoteUploadedOnlineFilesName(Long mcContentId) throws VoteApplicationException;
+ public List retrieveVoteUploadedOnlineFilesName(Long voteContentId) throws VoteApplicationException;
- public List retrieveVoteUploadedFiles(Long mcContentId, boolean fileOnline) throws VoteApplicationException;
+ public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) throws VoteApplicationException;
public void cleanUploadedFilesMetaData() throws VoteApplicationException;
- public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent mcContent) throws VoteApplicationException;
+ public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) throws VoteApplicationException;
- public List getAttemptForQueContent(final Long queUsrId, final Long mcQueContentId) throws VoteApplicationException;
+ public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException;
public List getAttemptsForUser(final Long queUsrId) throws VoteApplicationException;
public int countSessionComplete() throws VoteApplicationException;
- public VoteSession findVoteSessionById(Long mcSessionId) throws VoteApplicationException;
+ public VoteSession findVoteSessionById(Long voteSessionId) throws VoteApplicationException;
public int countSessionIncomplete() throws VoteApplicationException;
public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) throws RepositoryCheckedException;
public NodeKey copyFile(Long uuid) throws RepositoryCheckedException;
- public void removeOffLineFile(String filename, Long mcContentId) throws VoteApplicationException;
+ public void removeOffLineFile(String filename, Long voteContentId) throws VoteApplicationException;
- public void removeOnLineFile(String filename, Long mcContentId) throws VoteApplicationException;
+ public void removeOnLineFile(String filename, Long voteContentId) throws VoteApplicationException;
public boolean isOffLineFilePersisted(String filename) throws VoteApplicationException;
public boolean isOnLineFilePersisted(String filename) throws VoteApplicationException;
public boolean isUuidPersisted(String uuid) throws VoteApplicationException;
- public List getOnlineFilesMetaData(Long mcContentId) throws VoteApplicationException;
+ public List getOnlineFilesMetaData(Long voteContentId) throws VoteApplicationException;
- public List getOfflineFilesMetaData(Long mcContentId) throws VoteApplicationException;
+ public List getOfflineFilesMetaData(Long voteContentId) throws VoteApplicationException;
public List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException;
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java
===================================================================
diff -u -r2be43d0e5d701ff9c00b32c85e0d35f3367d52cb -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 2be43d0e5d701ff9c00b32c85e0d35f3367d52cb)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -1006,9 +1006,17 @@
VoteQueContent removeableVoteQueContent=voteService.getQuestionContentByQuestionText(queContent.getQuestion(), voteContent.getUid());
logger.debug("removeableVoteQueContent" + removeableVoteQueContent);
+
+
if (removeableVoteQueContent != null)
{
+ logger.debug("doing association removal for nomination: " + removeableVoteQueContent);
+ logger.debug("doing association removal, for question: " + removeableVoteQueContent.getQuestion());
+ logger.debug("doing association removal for nomination list: " + voteContent.getVoteQueContents());
+ voteContent.getVoteQueContents().remove(removeableVoteQueContent);
+
voteService.removeVoteQueContent(removeableVoteQueContent);
+
logger.debug("removed removeableVoteQueContent from the db: " + removeableVoteQueContent);
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java
===================================================================
diff -u -rdd298335db00afcb64815700a40f32b78c6b8998 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision dd298335db00afcb64815700a40f32b78c6b8998)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -156,7 +156,7 @@
{
List listUsers=voteService.getUserBySessionOnly(voteSession);
logger.debug("listMcUsers for session id:" + voteSession.getVoteSessionId() + " = " + listUsers);
- Map sessionUsersAttempts=populateSessionUsersAttempts(request,voteSession.getVoteSessionId(), listUsers, questionUid,
+ Map sessionUsersAttempts=populateSessionUsersAttempts(request,voteContent, voteSession.getVoteSessionId(), listUsers, questionUid,
isUserNamesVisible, isLearnerRequest, userId, voteService);
listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts);
}
@@ -185,7 +185,7 @@
{
List listUsers=voteService.getUserBySessionOnly(voteSession);
logger.debug("listMcUsers for session id:" + voteSession.getVoteSessionId() + " = " + listUsers);
- Map sessionUsersAttempts=populateSessionUsersAttempts(request,voteSession.getVoteSessionId(), listUsers, questionUid,
+ Map sessionUsersAttempts=populateSessionUsersAttempts(request,voteContent, voteSession.getVoteSessionId(), listUsers, questionUid,
isUserNamesVisible, isLearnerRequest, userId, voteService);
listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts);
}
@@ -201,12 +201,13 @@
}
- public static Map populateSessionUsersAttempts(HttpServletRequest request,Long sessionId, List listUsers, String questionUid,
+ public static Map populateSessionUsersAttempts(HttpServletRequest request, VoteContent voteContent, Long sessionId, List listUsers, String questionUid,
boolean isUserNamesVisible, boolean isLearnerRequest, String userId, IVoteService voteService)
{
logger.debug("doing populateSessionUsersAttempts for: " +questionUid);
logger.debug("isUserNamesVisible: " + isUserNamesVisible);
logger.debug("isLearnerRequest: " + isLearnerRequest);
+ logger.debug("voteContent: " + voteContent);
logger.debug("userId: " + userId);
logger.debug("doing populateSessionUsersAttempts...");
@@ -259,19 +260,32 @@
logger.debug("voteQueContent: " + voteQueContent);
String entry=voteQueContent.getQuestion();
logger.debug("entry: " + entry);
- if (entry != null)
- {
- if (entry.equals("sample nomination"))
- {
- logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
- voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
- }
- else
- {
- logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
- voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
- }
- }
+
+ String voteQueContentId=voteUsrResp.getVoteQueContentId().toString();
+ logger.debug("voteQueContentId: " + voteQueContentId);
+
+ VoteSession localUserSession=voteUsrResp.getVoteQueUsr().getVoteSession();
+ logger.debug("localUserSession: " + localUserSession);
+ logger.debug("localUserSession's content id: " + localUserSession.getVoteContentId());
+ logger.debug("incoming content id versus localUserSession's content id: " + voteContent.getVoteContentId() + " versus " + localUserSession.getVoteContentId());
+ logger.debug("summary reporting case 1" );
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
+ {
+ if (entry != null)
+ {
+ if (entry.equals("sample nomination") && (voteQueContentId.equals("1")))
+ {
+ logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
+ voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
+ }
+ else
+ {
+ logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
+ voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
+ }
+ }
+ }
+
listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
}
}
@@ -322,19 +336,32 @@
logger.debug("voteQueContent: " + voteQueContent);
String entry=voteQueContent.getQuestion();
logger.debug("entry: " + entry);
- if (entry != null)
- {
- if (entry.equals("sample nomination"))
- {
- logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
- voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
- }
- else
- {
- logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
- voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
- }
- }
+ String voteQueContentId=voteUsrResp.getVoteQueContentId().toString();
+ logger.debug("voteQueContentId: " + voteQueContentId);
+
+ VoteSession localUserSession=voteUsrResp.getVoteQueUsr().getVoteSession();
+ logger.debug("localUserSession: " + localUserSession);
+ logger.debug("localUserSession's content id: " + localUserSession.getVoteContentId());
+ logger.debug("incoming content id versus localUserSession's content id: " + voteContent.getVoteContentId() + " versus " + localUserSession.getVoteContentId());
+ logger.debug("summary reporting case 2" );
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
+ {
+ if (entry != null)
+ {
+ if (entry.equals("sample nomination") && (voteQueContentId.equals("1")))
+ {
+ logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
+ voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
+ }
+ else
+ {
+ logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
+ voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
+ }
+ }
+ }
+
+
listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
}
}
@@ -397,19 +424,32 @@
logger.debug("voteQueContent: " + voteQueContent);
String entry=voteQueContent.getQuestion();
logger.debug("entry: " + entry);
- if (entry != null)
- {
- if (entry.equals("sample nomination"))
- {
- logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
- voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
- }
- else
- {
- logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
- voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
- }
- }
+
+ String voteQueContentId=voteUsrResp.getVoteQueContentId().toString();
+ logger.debug("voteQueContentId: " + voteQueContentId);
+
+ VoteSession localUserSession=voteUsrResp.getVoteQueUsr().getVoteSession();
+ logger.debug("localUserSession: " + localUserSession);
+ logger.debug("localUserSession's content id: " + localUserSession.getVoteContentId());
+ logger.debug("incoming content id versus localUserSession's content id: " + voteContent.getVoteContentId() + " versus " + localUserSession.getVoteContentId());
+ logger.debug("summary reporting case 3" );
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
+ {
+ if (entry != null)
+ {
+ if (entry.equals("sample nomination") && (voteQueContentId.equals("1")))
+ {
+ logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
+ voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
+ }
+ else
+ {
+ logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
+ voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
+ }
+ }
+ }
+
listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
}
@@ -461,20 +501,32 @@
logger.debug("voteQueContent: " + voteQueContent);
String entry=voteQueContent.getQuestion();
logger.debug("entry: " + entry);
- if (entry != null)
- {
- if (entry.equals("sample nomination"))
- {
- logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
- voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
- }
- else
- {
- logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
- voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
- }
- }
+ String voteQueContentId=voteUsrResp.getVoteQueContentId().toString();
+ logger.debug("voteQueContentId: " + voteQueContentId);
+
+ VoteSession localUserSession=voteUsrResp.getVoteQueUsr().getVoteSession();
+ logger.debug("localUserSession: " + localUserSession);
+ logger.debug("localUserSession's content id: " + localUserSession.getVoteContentId());
+ logger.debug("incoming content id versus localUserSession's content id: " + voteContent.getVoteContentId() + " versus " + localUserSession.getVoteContentId());
+ logger.debug("summary reporting case 4" );
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
+ {
+ if (entry != null)
+ {
+ if (entry.equals("sample nomination") && (voteQueContentId.equals("1")))
+ {
+ logger.debug("this nomination entry points to a user entered nomination: " + voteUsrResp.getUserEntry());
+ voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry());
+ }
+ else
+ {
+ logger.debug("this nomination entry points to a standard nomination: " + voteQueContent.getQuestion());
+ voteMonitoredUserDTO.setResponse(voteQueContent.getQuestion());
+ }
+ }
+ }
+
listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
}
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java
===================================================================
diff -u -rdd298335db00afcb64815700a40f32b78c6b8998 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision dd298335db00afcb64815700a40f32b78c6b8998)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -123,6 +123,7 @@
voteAuthoringForm.resetUserAction();
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
return null;
}
@@ -135,6 +136,8 @@
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
/* determine whether the request is from Monitoring url Edit Activity*/
String sourceVoteStarter = (String) request.getAttribute(SOURCE_VOTE_STARTER);
@@ -166,6 +169,32 @@
logger.debug("firstEntry: " + firstEntry);
request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry);
+
+ IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE);
+ if (voteService == null)
+ voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
+ logger.debug("voteService :" +voteService);
+
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ /*true means there is at least 1 response*/
+ if (voteContent != null)
+ {
+ if (voteService.studentActivityOccurredGlobal(voteContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+ }
+
+
return (mapping.findForward(destination));
}
@@ -177,6 +206,8 @@
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
@@ -205,6 +236,30 @@
logger.debug("firstEntry: " + firstEntry);
request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry);
+ IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE);
+ if (voteService == null)
+ voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
+ logger.debug("voteService :" +voteService);
+
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ /*true means there is at least 1 response*/
+ if (voteContent != null)
+ {
+ if (voteService.studentActivityOccurredGlobal(voteContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+ }
+
return (mapping.findForward(destination));
}
@@ -217,6 +272,8 @@
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(true).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
/* determine whether the request is from Monitoring url Edit Activity*/
@@ -230,9 +287,42 @@
voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
logger.debug("voteService :" +voteService);
+
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ /*true means there is at least 1 response*/
+ if (voteContent != null)
+ {
+ if (voteService.studentActivityOccurredGlobal(voteContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+ }
+
VoteUtils.persistRichText(request);
- AuthoringUtil authoringUtil= new AuthoringUtil();
+ ActionMessages errors= new ActionMessages();
+ errors=validateSubmit(request, errors, voteAuthoringForm);
+
+ if (errors.size() > 0)
+ {
+ logger.debug("returning back to from to fix errors:");
+ request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true));
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(true).toString());
+ return mapping.findForward(destination);
+ }
+
+ List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST);
+ List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST);
+
Map mapOptionsContent=(Map)request.getSession().getAttribute(MAP_OPTIONS_CONTENT);
logger.debug("mapOptionsContent :" +mapOptionsContent);
@@ -249,21 +339,7 @@
logger.debug("firstEntry: " + firstEntry);
request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry);
-
- ActionMessages errors= new ActionMessages();
- /* full form validation should be performed only in standard authoring mode, but not in monitoring EditActivity */
- errors=validateSubmit(request, errors, voteAuthoringForm);
-
- if (errors.size() > 0)
- {
- logger.debug("returning back to from to fix errors:");
- request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true));
- return (mapping.findForward(LOAD_QUESTIONS));
- }
-
- List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST);
- List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST);
-
+ AuthoringUtil authoringUtil= new AuthoringUtil();
authoringUtil.reconstructOptionsContentMapForSubmit(mapOptionsContent, request);
logger.debug("before saveOrUpdateVoteContent.");
@@ -276,7 +352,7 @@
logger.debug("add error.options.duplicate to ActionMessages");
persistError(request,"error.options.duplicate");
voteAuthoringForm.resetUserAction();
- return (mapping.findForward(LOAD_QUESTIONS));
+ return mapping.findForward(destination);
}
@@ -286,7 +362,7 @@
authoringUtil.removeRedundantOptions(mapOptionsContent, voteService, voteAuthoringForm, request);
logger.debug("end of removing unused entries... ");
- VoteContent voteContent=authoringUtil.saveOrUpdateVoteContent(mapOptionsContent, voteService, voteAuthoringForm, request);
+ voteContent=authoringUtil.saveOrUpdateVoteContent(mapOptionsContent, voteService, voteAuthoringForm, request);
logger.debug("voteContent: " + voteContent);
String maxNomCount=voteAuthoringForm.getMaxNominationCount();
@@ -370,6 +446,8 @@
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
IVoteService voteService =VoteUtils.getToolService(request);
@@ -414,7 +492,27 @@
String firstEntry=(String)mapOptionsContent.get("1");
logger.debug("firstEntry: " + firstEntry);
request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry);
+
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ /*true means there is at least 1 response*/
+ if (voteContent != null)
+ {
+ if (voteService.studentActivityOccurredGlobal(voteContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+ }
+
+
return (mapping.findForward(destination));
}
@@ -433,6 +531,8 @@
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
IVoteService voteService =VoteUtils.getToolService(request);
/* determine whether the request is from Monitoring url Edit Activity*/
@@ -476,6 +576,26 @@
logger.debug("firstEntry: " + firstEntry);
request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry);
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ /*true means there is at least 1 response*/
+ if (voteContent != null)
+ {
+ if (voteService.studentActivityOccurredGlobal(voteContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+ }
+
+
return (mapping.findForward(destination));
}
@@ -490,16 +610,15 @@
String instructions = voteAuthoringForm.getInstructions();
logger.debug("instructions: " + instructions);
+ boolean validateSuccess=true;
if ((title == null) || (title.trim().length() == 0) || title.equalsIgnoreCase(RICHTEXT_BLANK))
{
- errors.add(Globals.ERROR_KEY,new ActionMessage("error.title"));
- logger.debug("add title to ActionMessages");
+ validateSuccess=false;
}
if ((instructions == null) || (instructions.trim().length() == 0) || instructions.equalsIgnoreCase(RICHTEXT_BLANK))
{
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.instructions"));
- logger.debug("add instructions to ActionMessages: ");
+ validateSuccess=false;
}
/*
@@ -508,8 +627,12 @@
String defaultOptionEntry =request.getParameter("optionContent0");
if ((defaultOptionEntry == null) || (defaultOptionEntry.length() == 0))
{
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.defaultoption.empt"));
- logger.debug("add error.defaultoption.empt to ActionMessages: ");
+ validateSuccess=false; }
+
+ if (validateSuccess == false)
+ {
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.fields.mandatory"));
+ logger.debug("validate success is false");
}
saveErrors(request,errors);
@@ -529,6 +652,8 @@
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
IVoteService voteService =VoteUtils.getToolService(request);
@@ -581,7 +706,9 @@
logger.debug("dispatching submitOnlineFiles...");
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
- voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
IVoteService voteService =VoteUtils.getToolService(request);
@@ -633,7 +760,9 @@
logger.debug("dispatching deleteOfflineFile...");
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
- voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
IVoteService voteService =VoteUtils.getToolService(request);
@@ -672,7 +801,9 @@
logger.debug("dispatching deleteOnlineFile...");
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
- voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
IVoteService voteService =VoteUtils.getToolService(request);
@@ -710,7 +841,9 @@
logger.debug("dispatching editActivityQuestions...");
VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form;
logger.debug("voteAuthoringForm :" +voteAuthoringForm);
- voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString());
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
+ request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString());
IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE);
logger.debug("voteService: " + voteService);
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java
===================================================================
diff -u -rb981d563ace42f1c943a2e847aa2f725249b82a8 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java (.../VoteAuthoringForm.java) (revision b981d563ace42f1c943a2e847aa2f725249b82a8)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java (.../VoteAuthoringForm.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -102,6 +102,8 @@
protected String exceptionMaxNominationInvalid;
+ protected String submissionAttempt;
+
public void resetUserAction()
{
this.editDefaultQuestion=null;
@@ -178,6 +180,7 @@
this.statsMonitoring=null;
this.edit=null;
this.submit=null;
+ this.submissionAttempt=null;
}
public void resetRadioBoxes()
@@ -756,4 +759,16 @@
public void setActiveModule(String activeModule) {
this.activeModule = activeModule;
}
+ /**
+ * @return Returns the submissionAttempt.
+ */
+ public String getSubmissionAttempt() {
+ return submissionAttempt;
+ }
+ /**
+ * @param submissionAttempt The submissionAttempt to set.
+ */
+ public void setSubmissionAttempt(String submissionAttempt) {
+ this.submissionAttempt = submissionAttempt;
+ }
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java
===================================================================
diff -u -r3a984c9bc1a3a01f8cd91635fb437dd44d07f950 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 3a984c9bc1a3a01f8cd91635fb437dd44d07f950)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -125,17 +125,16 @@
logger.debug("dispatching submitSession...");
IVoteService voteService=null;
- logger.debug("will retrieve voteService");
- voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
- logger.debug("retrieving voteService from session: " + voteService);
+ voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE);
+ logger.debug("voteService: " + voteService);
+
if (voteService == null)
{
- voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE);
- logger.debug("voteService: " + voteService);
+ logger.debug("will retrieve voteService");
+ voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
+ logger.debug("retrieving voteService from session: " + voteService);
}
-
-
VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form;
String currentMonitoredToolSession=voteMonitoringForm.getSelectedToolSessionId();
@@ -234,18 +233,20 @@
logger.debug("decide processing user entered values based on isLearnerRequest: " + isLearnerRequest);
- List listUserEntries=processUserEnteredNominations(voteService, currentSessionId, showUserEntriesBySession, userId, isLearnerRequest);
+ List listUserEntries=processUserEnteredNominations(voteService, voteContent, currentSessionId, showUserEntriesBySession, userId, isLearnerRequest);
logger.debug("listUserEntries: " + listUserEntries);
request.getSession().setAttribute(LIST_USER_ENTRIES, listUserEntries);
}
- public List processUserEnteredNominations(IVoteService voteService, String currentSessionId, boolean showUserEntriesBySession, String userId, boolean showUserEntriesByUserId)
+ public List processUserEnteredNominations(IVoteService voteService, VoteContent voteContent, String currentSessionId, boolean showUserEntriesBySession, String userId, boolean showUserEntriesByUserId)
{
logger.debug("start getting user entries, showUserEntriesBySession: " + showUserEntriesBySession);
logger.debug("start getting user entries, currentSessionId: " + currentSessionId);
logger.debug("start getting user entries, showUserEntriesByUserId: " + showUserEntriesByUserId);
logger.debug("start getting user entries, userId: " + userId);
+ logger.debug("start getting user entries, voteContent: " + voteContent);
+ logger.debug("start getting user entries, voteContent id: " + voteContent.getVoteContentId());
Set userEntries=voteService.getUserEntries();
logger.debug("userEntries: " + userEntries);
@@ -279,61 +280,88 @@
VoteUsrAttempt voteUsrAttempt =(VoteUsrAttempt)itUserRecords.next();
logger.debug("voteUsrAttempt: " + voteUsrAttempt);
+
+ VoteSession localUserSession=voteUsrAttempt.getVoteQueUsr().getVoteSession();
+ logger.debug("localUserSession: " + localUserSession);
+ logger.debug("localUserSession's content id: " + localUserSession.getVoteContentId());
+ logger.debug("incoming content id versus localUserSession's content id: " + voteContent.getVoteContentId() + " versus " + localUserSession.getVoteContentId());
+
if (showUserEntriesBySession == false)
{
- voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString());
- voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
- voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getUsername());
- voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
- voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
+ logger.debug("showUserEntriesBySession is false");
+ logger.debug("show user entries by same content only");
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
+ {
+ voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString());
+ voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
+ voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getUsername());
+ voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
+ voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
+ listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
+ }
}
else
{
logger.debug("showUserEntriesBySession is true");
+ logger.debug("show user entries by same content and same session and same user");
String userSessionId=voteUsrAttempt.getVoteQueUsr().getVoteSession().getVoteSessionId().toString() ;
logger.debug("userSessionId versus currentSessionId: " + userSessionId + " versus " + currentSessionId);
-
+
if (showUserEntriesByUserId == true)
{
- logger.debug("showUserEntriesByUserId is true");
- if (userSessionId.equals(currentSessionId))
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
{
- String localUserId=voteUsrAttempt.getVoteQueUsr().getQueUsrId().toString();
- if (userId.equals(localUserId))
+ logger.debug("showUserEntriesByUserId is true");
+ if (userSessionId.equals(currentSessionId))
{
- logger.debug("this is requested by user id: " + userId);
- voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString());
- voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
- voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getUsername());
- voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
- voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
-
+ String localUserId=voteUsrAttempt.getVoteQueUsr().getQueUsrId().toString();
+ if (userId.equals(localUserId))
+ {
+ logger.debug("this is requested by user id: " + userId);
+ voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString());
+ voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
+ voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getUsername());
+ voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
+ voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
+ listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
+ }
}
}
}
else
{
logger.debug("showUserEntriesByUserId is false");
- if (userSessionId.equals(currentSessionId))
- {
- logger.debug("this is requested by session id: " + currentSessionId);
- voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString());
- voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
- voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getUsername());
- voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
- voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
- }
+ logger.debug("show user entries by same content and same session");
+ if (voteContent.getVoteContentId().toString().equals(localUserSession.getVoteContentId().toString()))
+ {
+ if (userSessionId.equals(currentSessionId))
+ {
+ logger.debug("this is requested by session id: " + currentSessionId);
+ voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString());
+ voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
+ voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getUsername());
+ voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
+ voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
+ listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
+ }
+ }
}
}
- listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
+
}
logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO);
- Map mapMonitoredUserContainerDTO=MonitoringUtil.convertToVoteMonitoredUserDTOMap(listMonitoredUserContainerDTO);
- logger.debug("final user entry mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO);
+
+ logger.debug("final listMonitoredUserContainerDTO size: " + listMonitoredUserContainerDTO.size());
+ if (listMonitoredUserContainerDTO.size() > 0)
+ {
+ logger.debug("adding user entry's data");
+ Map mapMonitoredUserContainerDTO=MonitoringUtil.convertToVoteMonitoredUserDTOMap(listMonitoredUserContainerDTO);
+ logger.debug("final user entry mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO);
- voteMonitoredAnswersDTO.setQuestionAttempts(mapMonitoredUserContainerDTO);
- listUserEntries.add(voteMonitoredAnswersDTO);
+ voteMonitoredAnswersDTO.setQuestionAttempts(mapMonitoredUserContainerDTO);
+ listUserEntries.add(voteMonitoredAnswersDTO);
+ }
}
}
logger.debug("finish getting user entries: " + listUserEntries);
@@ -503,7 +531,7 @@
}
request.getSession().setAttribute(COUNT_ALL_USERS, new Integer(countAllUsers).toString());
-
+
int countSessionComplete=voteService.countSessionComplete();
logger.debug("countSessionComplete: " + countSessionComplete);
request.getSession().setAttribute(COUNT_SESSION_COMPLETE, new Integer(countSessionComplete).toString());
@@ -521,6 +549,36 @@
request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true));
VoteUtils.setDefineLater(request, true);
+
+ Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ logger.debug("toolContentId: " + toolContentId);
+
+ IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE);
+ if (voteService == null)
+ voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext());
+ logger.debug("voteService :" +voteService);
+
+
+ VoteContent voteContent=voteService.retrieveVote(toolContentId);
+ /*true means there is at least 1 response*/
+ if (voteContent != null)
+ {
+ if (voteService.studentActivityOccurredGlobal(voteContent))
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
+ }
+ else
+ {
+ request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
+ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true");
+ }
+ }
+
+ request.setAttribute(SOURCE_VOTE_STARTER, "monitoring");
+ logger.debug("SOURCE_VOTE_STARTER: monitoring");
+
+
return (mapping.findForward(LOAD_MONITORING));
}
@@ -540,7 +598,7 @@
public ActionForward addNewOption(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
- logger.debug("dispatching proxy editActivityQuestions...");
+ logger.debug("dispatching proxy addNewOption...");
request.setAttribute(SOURCE_VOTE_STARTER, "monitoring");
logger.debug("SOURCE_VOTE_STARTER: monitoring");
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java
===================================================================
diff -u -rdd298335db00afcb64815700a40f32b78c6b8998 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision dd298335db00afcb64815700a40f32b78c6b8998)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -102,25 +102,14 @@
logger.debug("toolContentId: " + toolContentId);
logger.debug("calling prepareChartData: " + toolContentId);
- //MonitoringUtil.prepareChartData(request, voteService, toolContentId, null);
VoteContent voteContent=voteService.retrieveVote(toolContentId);
- int allUserEntriesCount=voteService.getAllEntriesCount();
- logger.debug("allUserEntriesCount: " + allUserEntriesCount);
-
/*true means there is at least 1 response*/
if (voteService.studentActivityOccurredGlobal(voteContent))
{
request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
}
- /*
- else if (allUserEntriesCount > 0)
- {
- request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(false).toString());
- logger.debug("allUserEntriesCount is:" + allUserEntriesCount + " USER_EXCEPTION_NO_TOOL_SESSIONS is set to false");
- }
- */
else
{
request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString());
@@ -129,7 +118,8 @@
request.getSession().setAttribute(ACTIVE_MODULE, MONITORING);
- return (mapping.findForward(LOAD_MONITORING));
+ voteMonitoringForm.setSelectedToolSessionId("All");
+ return voteMonitoringAction.submitSession(mapping, form, request, response);
}
@@ -247,7 +237,7 @@
logger.debug("refreshing instructions data...");
voteMonitoringAction.refreshInstructionsData(request, voteContent);
-
+
logger.debug("end initializing monitoring data...");
return true;
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java
===================================================================
diff -u -rb981d563ace42f1c943a2e847aa2f725249b82a8 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision b981d563ace42f1c943a2e847aa2f725249b82a8)
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -128,6 +128,7 @@
}
request.getSession().setAttribute(TOOL_SERVICE, voteService);
request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0));
+ voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString());
String servletPath=request.getServletPath();
logger.debug("getServletPath: "+ servletPath);
Index: lams_tool_vote/web/authoring/BasicContent.jsp
===================================================================
diff -u -r0ab582175b03ab93a172f7ee84c105a3b8d267b7 -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5
--- lams_tool_vote/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 0ab582175b03ab93a172f7ee84c105a3b8d267b7)
+++ lams_tool_vote/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5)
@@ -32,6 +32,7 @@