Cleaned up the courses list and added some more metrics.
This commit is contained in:
parent
ae2886fe63
commit
035a7f9c44
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,22 +6,23 @@
|
|||
<body>
|
||||
|
||||
<div id="content">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Code</th>
|
||||
<th>Created at</th>
|
||||
<th>Students</th>
|
||||
</tr>
|
||||
<tr th:each="course: ${courses}">
|
||||
<td>
|
||||
<a th:href="@{/courses/{code}(code=${course.getCode()})}" th:text="${course.getName()}"></a>
|
||||
</td>
|
||||
<td th:text="${course.getCode()}"></td>
|
||||
<td th:text="${course.getCreatedOn()}"></td>
|
||||
<td th:text="${course.getStudents().size()}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1>Courses</h1>
|
||||
<hr>
|
||||
|
||||
<ul>
|
||||
<li th:each="course: ${courses}">
|
||||
<h2><a th:href="@{/courses/{code}(code=${course.getCode()})}" th:text="${course.getName()}"></a></h2>
|
||||
<ul>
|
||||
<li>Code: <span th:text="${course.getCode()}"></span></li>
|
||||
<li>Created on: <span th:text="${course.getCreatedOn()}"></span></li>
|
||||
<li>Students: <span th:text="${course.getStudents().size()}"></span></li>
|
||||
<li>Teaching Assistants: <span th:text="${course.getTeachingAssistants().size()}"></span></li>
|
||||
<li>Student Teams: <span th:text="${course.getStudentTeams().size()}"></span></li>
|
||||
<li>Teaching Assistant Teams: <span th:text="${course.getTeachingAssistantTeams().size()}"></span></li>
|
||||
<li>Number of Active Students (in a team): <span th:text="${course.getNumberOfStudentsInTeams()}"></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="sidebar">
|
||||
|
|
Loading…
Reference in New Issue