Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== diff -u -rd7bfc30e7d7a056b984f35c292a7abed4635c754 -r466b430b11cd214ae9c8a4737ea5f6ed9253ed27 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision d7bfc30e7d7a056b984f35c292a7abed4635c754) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 466b430b11cd214ae9c8a4737ea5f6ed9253ed27) @@ -1749,28 +1749,31 @@ learnerProgressDAO.updateLearnerProgress(learnerProgress); - // do ungrouping and unbranching - for (Activity activity : groupings) { - if (activity.isGroupingActivity()) { - // fetch real object, otherwise there is a cast error - GroupingActivity groupingActivity = (GroupingActivity) getActivityById(activity.getActivityId()); - Grouping grouping = groupingActivity.getCreateGrouping(); - if (grouping.doesLearnerExist(learner)) { - // cancel existing grouping, so the learner has a chance to be grouped again - Group group = grouping.getGroupBy(learner); - group.getUsers().remove(learner); - groupDAO.saveGroup(group); + if (removeLearnerContent) { + // do ungrouping and unbranching + for (Activity activity : groupings) { + if (activity.isGroupingActivity()) { + // fetch real object, otherwise there is a cast error + GroupingActivity groupingActivity = (GroupingActivity) getActivityById(activity.getActivityId()); + Grouping grouping = groupingActivity.getCreateGrouping(); + if (grouping.doesLearnerExist(learner)) { + // cancel existing grouping, so the learner has a chance to be grouped again + Group group = grouping.getGroupBy(learner); + group.getUsers().remove(learner); + groupDAO.saveGroup(group); + } + } else if (activity.isSequenceActivity()) { + SequenceActivity sequenceActivity = (SequenceActivity) getActivityById(activity.getActivityId()); + Group group = sequenceActivity.getSoleGroupForBranch(); + if ((group != null) && group.hasLearner(learner)) { + // remove learner from the branch + removeUsersFromBranch(sequenceActivity.getActivityId(), + new String[] { learner.getUserId().toString() }); + } + } else { + MonitoringService.log.warn( + "Unknow activity type marked for ungrouping: " + activity.getActivityId()); } - } else if (activity.isSequenceActivity()) { - SequenceActivity sequenceActivity = (SequenceActivity) getActivityById(activity.getActivityId()); - Group group = sequenceActivity.getSoleGroupForBranch(); - if ((group != null) && group.hasLearner(learner)) { - // remove learner from the branch - removeUsersFromBranch(sequenceActivity.getActivityId(), - new String[] { learner.getUserId().toString() }); - } - } else { - MonitoringService.log.warn("Unknow activity type marked for ungrouping: " + activity.getActivityId()); } } Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java =================================================================== diff -u -rd7bfc30e7d7a056b984f35c292a7abed4635c754 -r466b430b11cd214ae9c8a4737ea5f6ed9253ed27 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision d7bfc30e7d7a056b984f35c292a7abed4635c754) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/service/AssessmentServiceImpl.java (.../AssessmentServiceImpl.java) (revision 466b430b11cd214ae9c8a4737ea5f6ed9253ed27) @@ -312,7 +312,6 @@ userOptionAnswers.add(userOptionAnswer); } - userQuestionResult.setJustification(leaderQuestionResult.getJustification()); } } else if (userResult.getFinishDate().equals(leaderResult.getFinishDate())) { // the latest result is already copied, so no need to copy it again @@ -341,6 +340,7 @@ userQuestionResult.setMaxMark(leaderQuestionResult.getMaxMark()); userQuestionResult.setPenalty(leaderQuestionResult.getPenalty()); userQuestionResult.setConfidenceLevel(leaderQuestionResult.getConfidenceLevel()); + userQuestionResult.setJustification(leaderQuestionResult.getJustification()); Set leaderOptionAnswers = leaderQuestionResult.getOptionAnswers(); Set userOptionAnswers = userQuestionResult.getOptionAnswers(); Index: lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionService.java =================================================================== diff -u -rd7bfc30e7d7a056b984f35c292a7abed4635c754 -r466b430b11cd214ae9c8a4737ea5f6ed9253ed27 --- lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionService.java (.../LeaderselectionService.java) (revision d7bfc30e7d7a056b984f35c292a7abed4635c754) +++ lams_tool_leader/src/java/org/lamsfoundation/lams/tool/leaderselection/service/LeaderselectionService.java (.../LeaderselectionService.java) (revision 466b430b11cd214ae9c8a4737ea5f6ed9253ed27) @@ -71,7 +71,7 @@ public class LeaderselectionService implements ToolSessionManager, ToolContentManager, ILeaderselectionService, ToolRestManager { - private static Logger logger = Logger.getLogger(LeaderselectionService.class.getName()); + private static Logger log = Logger.getLogger(LeaderselectionService.class.getName()); private ILeaderselectionDAO leaderselectionDAO = null; @@ -92,10 +92,9 @@ /* ************ Methods from ToolSessionManager ************* */ @Override public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { - if (logger.isDebugEnabled()) { - logger.debug( - "entering method createToolSession:" + " toolSessionId = " + toolSessionId + " toolSessionName = " - + toolSessionName + " toolContentId = " + toolContentId); + if (log.isDebugEnabled()) { + log.debug("entering method createToolSession:" + " toolSessionId = " + toolSessionId + " toolSessionName = " + + toolSessionName + " toolContentId = " + toolContentId); } LeaderselectionSession session = new LeaderselectionSession(); @@ -164,8 +163,8 @@ @Override public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException { - if (logger.isDebugEnabled()) { - logger.debug("entering method copyToolContent:" + " fromContentId=" + fromContentId + " toContentId=" + if (log.isDebugEnabled()) { + log.debug("entering method copyToolContent:" + " fromContentId=" + fromContentId + " toContentId=" + toContentId); } @@ -201,7 +200,7 @@ public void removeToolContent(Long toolContentId) throws ToolException { Leaderselection content = leaderselectionDAO.getByContentId(toolContentId); if (content == null) { - logger.warn("Can not remove the tool content as it does not exist, ID: " + toolContentId); + log.warn("Can not remove the tool content as it does not exist, ID: " + toolContentId); return; } for (LeaderselectionSession session : content.getLeaderselectionSessions()) { @@ -219,11 +218,14 @@ @SuppressWarnings("unchecked") public void removeLearnerContent(Long toolContentId, Integer userId, boolean resetActivityCompletionOnly) throws ToolException { - // effect is the same whether resetActivityCompletionOnly is true or false - - if (logger.isDebugEnabled()) { - logger.debug( - "Removing Leader Selection state for user ID " + userId + " and toolContentId " + toolContentId); + if (log.isDebugEnabled()) { + if (resetActivityCompletionOnly) { + log.debug("Resetting Leader Selection completion for user ID " + userId + " and toolContentId " + + toolContentId); + } else { + log.debug("Removing Leader Selection content for user ID " + userId + " and toolContentId " + + toolContentId); + } } Leaderselection selection = leaderselectionDAO.getByContentId(toolContentId); @@ -232,7 +234,8 @@ } for (LeaderselectionSession session : selection.getLeaderselectionSessions()) { - if ((session.getGroupLeader() != null) && session.getGroupLeader().getUserId().equals(userId.longValue())) { + if (!resetActivityCompletionOnly && (session.getGroupLeader() != null) && session.getGroupLeader() + .getUserId().equals(userId.longValue())) { session.setGroupLeader(null); leaderselectionSessionDAO.update(session); } @@ -333,7 +336,7 @@ LeaderselectionSession session = getSessionBySessionId(toolSessionId); LeaderselectionUser newLeader = getUserByUID(userUid); if ((session == null) || (newLeader == null)) { - logger.error("Wrong parameters supplied. SessionId=" + toolSessionId + " UserId=" + userUid); + log.error("Wrong parameters supplied. SessionId=" + toolSessionId + " UserId=" + userUid); return false; } @@ -386,7 +389,7 @@ long toolContentId = toolService.getToolDefaultContentIdBySignature(toolSignature); if (toolContentId == 0) { String error = "Could not retrieve default content id for this tool"; - logger.error(error); + log.error(error); throw new LeaderselectionException(error); } return toolContentId; @@ -398,7 +401,7 @@ Leaderselection defaultContent = getContentByContentId(defaultContentID); if (defaultContent == null) { String error = "Could not retrieve default content record for this tool"; - logger.error(error); + log.error(error); throw new LeaderselectionException(error); } return defaultContent; @@ -409,7 +412,7 @@ if (newContentID == null) { String error = "Cannot copy the Leaderselection tools default content: + " + "newContentID is null"; - logger.error(error); + log.error(error); throw new LeaderselectionException(error); } @@ -425,7 +428,7 @@ public Leaderselection getContentByContentId(Long toolContentID) { Leaderselection leaderselection = leaderselectionDAO.getByContentId(toolContentID); if (leaderselection == null) { - logger.debug("Could not find the content with toolContentID:" + toolContentID); + log.debug("Could not find the content with toolContentID:" + toolContentID); } return leaderselection; } @@ -434,7 +437,7 @@ public LeaderselectionSession getSessionBySessionId(Long toolSessionId) { LeaderselectionSession leaderselectionSession = leaderselectionSessionDAO.getBySessionId(toolSessionId); if (leaderselectionSession == null) { - logger.debug("Could not find the leaderselection session with toolSessionID:" + toolSessionId); + log.debug("Could not find the leaderselection session with toolSessionID:" + toolSessionId); } return leaderselectionSession; }