Name | -Code | -Created at | -Students | -
---|---|---|---|
- - | -- | - | - |
Courses
++ +
diff --git a/src/main/java/nl/andrewlalis/teaching_assistant_assistant/controllers/courses/entity/student_teams/MergeSingleTeams.java b/src/main/java/nl/andrewlalis/teaching_assistant_assistant/controllers/courses/entity/student_teams/MergeSingleTeams.java index e7980e4..1d5ac35 100644 --- a/src/main/java/nl/andrewlalis/teaching_assistant_assistant/controllers/courses/entity/student_teams/MergeSingleTeams.java +++ b/src/main/java/nl/andrewlalis/teaching_assistant_assistant/controllers/courses/entity/student_teams/MergeSingleTeams.java @@ -15,6 +15,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +/** + * Controller for the action to merge all single teams in a course. + * TODO: Implement this functionality automatically. + */ @Controller public class MergeSingleTeams { diff --git a/src/main/java/nl/andrewlalis/teaching_assistant_assistant/model/Course.java b/src/main/java/nl/andrewlalis/teaching_assistant_assistant/model/Course.java index e22cf53..d1dfe0b 100644 --- a/src/main/java/nl/andrewlalis/teaching_assistant_assistant/model/Course.java +++ b/src/main/java/nl/andrewlalis/teaching_assistant_assistant/model/Course.java @@ -6,6 +6,7 @@ import nl.andrewlalis.teaching_assistant_assistant.model.people.Student; import nl.andrewlalis.teaching_assistant_assistant.model.people.TeachingAssistant; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam; +import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.Team; import javax.persistence.*; import java.util.ArrayList; @@ -205,4 +206,18 @@ public class Course extends BasicEntity { } return sb.toString(); } + + public int getNumberOfStudentsInTeams() { + int sum = 0; + for (Student s : this.getStudents()) { + for (Team team : s.getTeams()) { + if (team.getCourse().equals(this)) { + sum++; + break; + } + } + } + + return sum; + } } diff --git a/src/main/resources/templates/courses.html b/src/main/resources/templates/courses.html index 42b41e7..a225f7a 100644 --- a/src/main/resources/templates/courses.html +++ b/src/main/resources/templates/courses.html @@ -6,22 +6,23 @@