Fixed duplicate error, added debug messages.
This commit is contained in:
parent
06cbf34b54
commit
643124f242
|
@ -35,8 +35,7 @@ public class StudentService {
|
|||
if (course != null) {
|
||||
course.addParticipant(student);
|
||||
student.assignToCourse(course);
|
||||
this.courseRepository.save(course);
|
||||
this.studentRepository.save(student);
|
||||
this.courseRepository.save(course); // This cascades to save the student as well.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class StudentTeamService {
|
|||
StudentTeam newTeam = new StudentTeam(course);
|
||||
course.addStudentTeam(newTeam);
|
||||
this.courseRepository.save(course);
|
||||
logger.info("Created new team: " + newTeam.getId());
|
||||
logger.info("Created new team.");
|
||||
|
||||
return newTeam;
|
||||
}
|
||||
|
@ -185,13 +185,19 @@ public class StudentTeamService {
|
|||
s.removeFromAssignedTeam(team);
|
||||
team.removeMember(s);
|
||||
this.studentRepository.save(s);
|
||||
|
||||
logger.debug("Removed student " + s.getFullName() + " from team " + team.getId());
|
||||
}
|
||||
|
||||
// Remove the TA team assignment.
|
||||
TeachingAssistantTeam teachingAssistantTeam = team.getAssignedTeachingAssistantTeam();
|
||||
if (teachingAssistantTeam != null) {
|
||||
teachingAssistantTeam.removeAssignedStudentTeam(team);
|
||||
team.setAssignedTeachingAssistantTeam(null);
|
||||
this.teachingAssistantTeamRepository.save(teachingAssistantTeam);
|
||||
logger.debug("Removed team " + team.getId() + " from Teaching Assistant Team " + teachingAssistantTeam.getId() + " assigned teams list.");
|
||||
}
|
||||
|
||||
team.setAssignedTeachingAssistantTeam(null);
|
||||
|
||||
// Remove the repository from the course and delete it.
|
||||
course.removeStudentTeam(team);
|
||||
|
|
Loading…
Reference in New Issue