Skip to content
Snippets Groups Projects

Redirect to request when there is a processing request

2 files
+ 80
8
Compare changes
  • Side-by-side
  • Inline

Files

@@ -49,6 +49,7 @@ import nl.tudelft.queue.dto.patch.labs.ExamLabPatchDTO;
import nl.tudelft.queue.dto.patch.labs.RegularLabPatchDTO;
import nl.tudelft.queue.dto.patch.labs.SlottedLabPatchDTO;
import nl.tudelft.queue.dto.view.RequestViewDTO;
import nl.tudelft.queue.model.LabRequest;
import nl.tudelft.queue.model.QueueSession;
import nl.tudelft.queue.model.Request;
import nl.tudelft.queue.model.embeddables.AllowedRequest;
@@ -142,10 +143,16 @@ public class LabController {
.collect(Collectors.toList()));
// Check whether there is an open request for the authenticated user and add it to the model
qSession.getOpenRequestForPerson(person.getId()).ifPresent(r -> {
model.addAttribute("current", r.toViewDTO());
model.addAttribute("currentDto", new ModelMapper().map(r, RequestPatchDTO.class));
});
Optional<?> currOptRequest = qSession.getOpenRequestForPerson(person.getId());
if (currOptRequest.isPresent()) {
Request<?> currRequest = (Request<?>) currOptRequest.get();
// If the user is currently being processed it should be looking at the request page
if (currRequest.getEventInfo().getStatus().isProcessing()) {
return "redirect:/request/" + currRequest.getId();
}
model.addAttribute("current", currRequest.toViewDTO());
model.addAttribute("currentDto", new ModelMapper().map(currRequest, RequestPatchDTO.class));
}
// Check whether there is a finished selection request for the authenticated user and add it
if (qSession instanceof CapacitySession) {
Loading