Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ICoreLearnerService.java =================================================================== diff -u -rd15ad2104997c36ac5ccb243c2d3db1d42e60f33 -r36a3c1beea2e7fbd8109512d89e6bfa39d965c51 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ICoreLearnerService.java (.../ICoreLearnerService.java) (revision d15ad2104997c36ac5ccb243c2d3db1d42e60f33) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ICoreLearnerService.java (.../ICoreLearnerService.java) (revision 36a3c1beea2e7fbd8109512d89e6bfa39d965c51) @@ -213,10 +213,9 @@ * id of the group chosen by the learner * @param learnerId * the learner who triggers the grouping. - * @return true if the learner was successfully added to the group; false if the group was empty * @throws LearnerServiceException */ - boolean learnerChooseGroup(Long lessonId, Long groupingActivityId, Long groupId, Integer learnerId) + void learnerChooseGroup(Long lessonId, Long groupingActivityId, Long groupId, Integer learnerId) throws LearnerServiceException; /** Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java =================================================================== diff -u -rd15ad2104997c36ac5ccb243c2d3db1d42e60f33 -r36a3c1beea2e7fbd8109512d89e6bfa39d965c51 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision d15ad2104997c36ac5ccb243c2d3db1d42e60f33) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 36a3c1beea2e7fbd8109512d89e6bfa39d965c51) @@ -714,7 +714,7 @@ * {@inheritDoc} */ @Override - public boolean learnerChooseGroup(Long lessonId, Long groupingActivityId, Long groupId, Integer learnerId) + public void learnerChooseGroup(Long lessonId, Long groupingActivityId, Long groupId, Integer learnerId) throws LearnerServiceException { GroupingActivity groupingActivity = (GroupingActivity) activityDAO.getActivityByActivityId(groupingActivityId, GroupingActivity.class); @@ -725,7 +725,7 @@ User learner = (User) userManagementService.findById(User.class, learnerId); if (grouping.doesLearnerExist(learner)) { - return true; + return; } if (learner != null) { Integer maxNumberOfLearnersPerGroup = null; @@ -747,18 +747,16 @@ for (Group group : groups) { if (group.getGroupId().equals(groupId)) { if (group.getUsers().size() >= maxNumberOfLearnersPerGroup) { - return false; + return; } } } } lessonService.performGrouping(grouping, groupId, learner); - return true; } } } - return false; } private boolean forceGrouping(Lesson lesson, Grouping grouping, Group group, User learner) { Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java =================================================================== diff -u -rd15ad2104997c36ac5ccb243c2d3db1d42e60f33 -r36a3c1beea2e7fbd8109512d89e6bfa39d965c51 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java (.../GroupingAction.java) (revision d15ad2104997c36ac5ccb243c2d3db1d42e60f33) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java (.../GroupingAction.java) (revision 36a3c1beea2e7fbd8109512d89e6bfa39d965c51) @@ -38,6 +38,7 @@ import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.DynaActionForm; +import org.apache.struts.action.RedirectingActionForward; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; @@ -69,17 +70,7 @@ *

* * @author Jacky Fang - * @since 2005-3-29 - * @version 1.1 * - * - * - * - * - * - * - * - * */ public class GroupingAction extends LamsDispatchAction { @@ -278,21 +269,13 @@ Long groupId = WebUtil.readLongParam(request, "groupId"); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Long lessonId = learnerProgress.getLesson().getLessonId(); - boolean learnerGroupped = learnerService.learnerChooseGroup(lessonId, activity.getActivityId(), groupId, - LearningWebUtil.getUserId()); - if (learnerGroupped) { - return viewGrouping(mapping, form, request, response, learnerProgress); - } - Long groupingId = ((GroupingActivity) activity).getCreateGrouping().getGroupingId(); + learnerService.learnerChooseGroup(lessonId, activity.getActivityId(), groupId, LearningWebUtil.getUserId()); - Integer maxNumberOfLeaernersPerGroup = learnerService.calculateMaxNumberOfLearnersPerGroup(lessonId, - groupingId); - LearnerChoiceGrouping grouping = (LearnerChoiceGrouping) learnerService.getGrouping(groupingId); - prepareGroupData(request); - request.setAttribute(GroupingAction.MAX_LEARNERS_PER_GROUP, maxNumberOfLeaernersPerGroup); - request.setAttribute(GroupingAction.LOCAL_FILES, Boolean.FALSE); - request.setAttribute(GroupingAction.VIEW_STUDENTS_BEFORE_SELECTION, grouping.getViewStudentsBeforeSelection()); - return mapping.findForward(GroupingAction.CHOOSE_GROUP); + String redirectURL = "/grouping.do"; + redirectURL = WebUtil.appendParameterToURL(redirectURL, "method", "performGrouping"); + redirectURL = WebUtil.appendParameterToURL(redirectURL, "activityID", activity.getActivityId().toString()); + + return new RedirectingActionForward(redirectURL); } } \ No newline at end of file