Skip to content

Commit c6c18ef

Browse files
committed
Don't create two workgroups per student
1 parent 7813e72 commit c6c18ef

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/main/java/org/wise/portal/presentation/web/controllers/survey/SurveyAPIController.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void launchSurveyRun(@PathVariable String code, HttpServletResponse respo
6464
throws AuthorityNotFoundException, IOException, DuplicateUsernameException, ObjectNotFoundException,
6565
PeriodNotFoundException, StudentUserAlreadyAssociatedWithRunException, RunHasEndedException {
6666

67-
Projectcode projectCode = new Projectcode(code.replaceAll("++", " "));
67+
Projectcode projectCode = new Projectcode(code.replaceAll("\\+\\+", " "));
6868
Run run = runService.retrieveRunByRuncode(projectCode.getRuncode());
6969
if (run.getIsSurvey()) {
7070
if (!SecurityContextHolder.getContext().getAuthentication().getPrincipal().equals("anonymousUser")) { // Already signed in
@@ -73,7 +73,6 @@ public void launchSurveyRun(@PathVariable String code, HttpServletResponse respo
7373
User user = this.createNewStudentAccount();
7474
loginStudent(request, user);
7575
studentService.addStudentToRun(user, projectCode);
76-
createWorkgroupForUser(user, run);
7776
response.sendRedirect("/student/unit/" + run.getId());
7877
} else {
7978
response.sendRedirect("/survey/workgroupLimitReached");
@@ -87,12 +86,6 @@ private Boolean underWorkgroupLimit(Run run) {
8786
return workgroupService.getWorkgroupsForRun(run).size() <= 1000;
8887
}
8988

90-
private void createWorkgroupForUser(User user, Run run) throws ObjectNotFoundException {
91-
Set<User> userSet = new HashSet<User>();
92-
userSet.add(user);
93-
workgroupService.createWorkgroup("Workgroup for user: " + user.getUserDetails().getUsername(), userSet, run, run.getPeriodOfStudent(user));
94-
}
95-
9689
private void loginStudent(HttpServletRequest request, User user) {
9790
UsernamePasswordAuthenticationToken authReq = new UsernamePasswordAuthenticationToken(user.getUserDetails().getUsername(), "null");
9891
Authentication auth = authenticationManager.authenticate(authReq);

0 commit comments

Comments
 (0)