made sure you cant select yourself as idea partner
This commit is contained in:
parent
ed0a4560b0
commit
13807ad06b
@ -93,16 +93,18 @@ public class SupervisorIdeaServiceImpl extends AbstractQueryService<SupervisorId
|
||||
return false; //You may not add more than a specified number of partners.
|
||||
} else {
|
||||
SupervisorIdea idea = supervisorIdeaRepo.findOne(model.getObject().getId());
|
||||
if(idea.getProjectClass().getCode().equals(ProjectClass.BACHELOR)&&studentSet.isEmpty()){
|
||||
if(idea.getProjectClass().getCode().equals(ProjectClass.BACHELOR) && studentSet.isEmpty()){
|
||||
return false; //You need to select a partner if the idea is on bachelor level.
|
||||
}
|
||||
Student author = studentService.findByUser(mainAuthor);
|
||||
if(studentSet.contains(author)) {
|
||||
return false; //You may not select yourself as partner.
|
||||
}
|
||||
IdeaParticipation mainParticipation = new IdeaParticipation();
|
||||
mainParticipation.setStudent(author);
|
||||
mainParticipation.setSupervisorIdea(idea);
|
||||
mainParticipation.setConfirmed(true);
|
||||
author.addIdeaParticipation(mainParticipation);
|
||||
|
||||
for(Student s : studentSet) {
|
||||
s = studentService.findOne(s.getId()); //Needed for lazy loading to work.
|
||||
IdeaParticipation ip = new IdeaParticipation();
|
||||
|
Loading…
x
Reference in New Issue
Block a user