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

add bs button group for filter

parent b68dad66
2 merge requests!724Deploy,!623Resolve Amount of requests per TA In a single lab + the time taken since the last lab.
......@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- A table showing request per ta and time since last interaction was added in lab statistics. [@hpage](https://gitlab.ewi.tudelft.nl/hpage)
### Changed
......@@ -105,7 +106,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow users to view and create new shared editions. [@cedricwillekens](https://gitlab.ewi.tudelft.nl/cedricwilleken)
- Add room images for student requests [@cedricwilleken](https://gitlab.ewi.tudelft.nl/cedricwilleken)
- Hybrid Labs are now supported regardless of what the direction of the lab is. [@hpage](https://gitlab.ewi.tudelft.nl/hpage)
- A table showing request per ta and time since last interaction was added in lab statistics. [@hpage](https://gitlab.ewi.tudelft.nl/hpage)
- Added buttons to edit sessions for a shared lab [@hpage](https://gitlab.ewi.tudelft.nl/hpage)
### Changed
......
......@@ -67,7 +67,7 @@ public class LabStatusController {
var session = sCache.getOrThrow(qSession.getSession());
// TODO add filter functionality once UI is updated.
model.addAttribute("assistantMap",
model.addAttribute("interactionTimes",
labStatusService.getTimeSinceLastRequestTA(qSession, new HashSet<>()));
model.addAttribute("qSession", qSession.toViewDTO());
......
/*
* Queue - A Queueing system that can be used to handle labs in higher education
* Copyright (C) 2016-2021 Delft University of Technology
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package nl.tudelft.queue.dto.view.statistics;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TimeSinceRequestViewDto {
private String assistantDisplayName;
private String timeSinceLastRequest;
private long requestsTakenByTA;
}
......@@ -25,13 +25,13 @@ import java.util.stream.Collectors;
import nl.tudelft.labracore.api.dto.EditionSummaryDTO;
import nl.tudelft.queue.cache.EditionRolesCacheManager;
import nl.tudelft.queue.cache.SessionCacheManager;
import nl.tudelft.queue.dto.view.statistics.TimeSinceRequestViewDto;
import nl.tudelft.queue.model.LabRequest;
import nl.tudelft.queue.model.QueueSession;
import nl.tudelft.queue.model.RequestEvent;
import nl.tudelft.queue.model.events.EventWithAssistant;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -59,7 +59,7 @@ public class LabStatusService {
* @return A map containing assistant names as keys, and the time since their last request
* interaction as values (formatted as HH:MM:SS)
*/
public Map<String, Pair<Long, String>> getTimeSinceLastRequestTA(
public List<TimeSinceRequestViewDto> getTimeSinceLastRequestTA(
QueueSession<?> qSession, Set<Long> editionFilter) {
var session = sCache.getOrThrow(qSession.getSession());
var rolesPerEdition = eRolesCache.get(session.getEditions().stream().map(EditionSummaryDTO::getId));
......@@ -85,10 +85,11 @@ public class LabStatusService {
// combine the request per assistant, and time since last request interaction
return timesSinceLastRequestFormatted.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
entry -> Pair.of(requestsPerAssistant.getOrDefault(entry.getKey(), 0L),
entry.getValue())));
.map(entry -> new TimeSinceRequestViewDto(
entry.getKey(),
entry.getValue(),
requestsPerAssistant.getOrDefault(entry.getKey(), 0L)))
.collect(Collectors.toList());
}
......@@ -97,10 +98,11 @@ public class LabStatusService {
* ALREADY</b> interacted with something in the lab.
*
* @param qs The session to consider
* @return A mapping of (already participating) assistant IDs to the time in milliseconds since their
* last request interaction.
* @param editionFilter The editions within the lab we should consider
* @return A mapping of (already participating) assistant IDs to the time in milliseconds
* since their last request interaction.
*/
private Map<Long, Long> getTimeSinceLastInteractionAllTA(QueueSession<?> qs) {
private Map<Long, Long> getTimeSinceLastInteractionAllTA(QueueSession<?> qs, Set<Long> editionFilter) {
return qs.getRequests().stream().flatMap(request -> request.getEventInfo().getEvents().stream())
.filter(event -> event instanceof EventWithAssistant)
.map(event -> (EventWithAssistant) event)
......
......@@ -4,6 +4,9 @@
<head>
<title>Lab Status</title>
<script src="/webjars/momentjs/min/moment.min.js"></script>
<script src="/webjars/chartjs/Chart.min.js"></script>
<script src="/js/lab_status_charts.js"></script>
</head>
<body>
......@@ -12,25 +15,29 @@
<link rel="stylesheet" href="/webjars/bootstrap-select/css/bootstrap-select.min.css"
type="text/css"/>
<script src="/webjars/momentjs/min/moment.min.js"></script>
<script src="/webjars/chartjs/Chart.min.js"></script>
<script src="/js/lab_status_charts.js"></script>
<div class="page-sub-header">
<h3>Status</h3>
</div>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<div th:each="edition : ${editions}">
<label class="btn btn-primary">
<input type="checkbox" th:text="${edition.course.name}" th:id="${edition.id}">
</label>
</div>
</div>
<div id="assistant-table" class="table-container">
<table class="table">
<table class="table table-striped table-hover">
<tr>
<th>Assistant</th>
<th>Requests Processed</th>
<th>Time Since Previous Request Interaction</th>
</tr>
<tr th:each="assistant : ${assistantMap}">
<td th:text="${assistant.key}"></td>
<td th:text="${assistant.value.getKey()}"></td>
<td th:text="${assistant.value.getValue()}"></td>
<tr th:each="assistantTimePair : ${interactionTimes}">
<td th:text="${assistantTimePair.assistantDisplayName}"></td>
<td th:text="${assistantTimePair.requestsTakenByTA}"></td>
<td th:text="${assistantTimePair.timeSinceLastRequest}"></td>
</tr>
</table>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment