Skip to content
Snippets Groups Projects
Commit 7e610155 authored by Henry Page's avatar Henry Page :speech_balloon:
Browse files

temp

parent 661b4da4
No related branches found
No related tags found
2 merge requests!711Version 2.2.1,!667Resolve "Divide requests over TAs"
......@@ -18,6 +18,7 @@
package nl.tudelft.queue.service;
import static java.time.LocalDateTime.now;
import static nl.tudelft.labracore.api.dto.RolePersonDetailsDTO.TypeEnum.*;
import static nl.tudelft.queue.misc.QueueSessionStatus.*;
import java.io.IOException;
......
......@@ -28,6 +28,8 @@ import nl.tudelft.labracore.api.RoleControllerApi;
import nl.tudelft.labracore.api.dto.*;
import nl.tudelft.labracore.lib.security.user.Person;
import nl.tudelft.queue.cache.EditionRolesCacheManager;
import nl.tudelft.queue.cache.SessionCacheManager;
import nl.tudelft.queue.model.QueueSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -40,6 +42,9 @@ public class RoleDTOService {
@Autowired
private RoleControllerApi rApi;
@Autowired
private SessionCacheManager sessionCacheManager;
public List<String> names(List<PersonSummaryDTO> people) {
return people.stream().map(PersonSummaryDTO::getDisplayName).collect(Collectors.toList());
}
......@@ -131,6 +136,17 @@ public class RoleDTOService {
return roles(eDto, Set.of(TA));
}
public List<PersonSummaryDTO> assistantsAndManagers(QueueSession<?> qSession) {
return erCache
.getAndIgnoreMissing(sessionCacheManager.getRequired(qSession.getId()).getEditions().stream()
.map(EditionSummaryDTO::getId))
.stream().flatMap(rh -> rh.getRoles().stream())
.filter(role -> Set.of(TA, HEAD_TA, TEACHER, TEACHER_RO).contains(role.getType()))
.map(RolePersonDetailsDTO::getPerson)
.distinct()
.collect(Collectors.toList());
}
public List<PersonSummaryDTO> headTAs(EditionDetailsDTO eDto) {
return roles(eDto, Set.of(HEAD_TA));
}
......
......@@ -34,6 +34,10 @@
<a href="#ts-capacity-tab" class="nav-link" data-toggle="list" aria-selected="true"><i
class="fa fa-chair"></i> Edit Time-slot Capacity</a>
</li>
<li class="nav-item" role="tab">
<a href="#ts-distribution-tab" class="nav-link" data-toggle="list" aria-selected="true"><i
class="fa fa-solid fa-people"></i> Distribute Requests</a>
</li>
</ul>
<div class="tab-content">
......@@ -192,6 +196,30 @@
</div>
</th:block>
<th:block th:if="${@permissionService.canManageSession(qSession.data)}">
<div id="ts-distribution-tab" class="tab-pane fade">
<h2>Distribute Requests</h2>
<p>Distribute pending requests among selected TAs.</p>
<form th:with="allAssistants = ${@roleDTOService.assistantsAndManagers(qSession.data)}">
<label class="col-sm-1 col-form-label" for="assistant-select">Select Assistants:</label>
<div class="col-sm-3">
<select multiple class="selectpicker form-control"
id="assistant-select"
data-live-search="true"
required>
<th:block th:each="assistant : ${allAssistants}">
<option th:value="${assistant.id}"
th:text="|${assistant.displayName}|">
</option>
</th:block>
</select>
</div>
</form>
</div>
</th:block>
<hr>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment