Skip to content
Snippets Groups Projects
Commit 923a5ba3 authored by Otto Visser's avatar Otto Visser
Browse files

Update spring boot and resolve minor issues

parent 34f380d9
Branches
Tags
1 merge request!630New release
...@@ -55,7 +55,7 @@ plugins { ...@@ -55,7 +55,7 @@ plugins {
// Spring plugins for managing dependencies and creating // Spring plugins for managing dependencies and creating
// a nice Spring Boot application. // a nice Spring Boot application.
id("org.springframework.boot").version("2.5.12") id("org.springframework.boot").version("2.5.14")
id("io.spring.dependency-management").version("1.0.11.RELEASE") id("io.spring.dependency-management").version("1.0.11.RELEASE")
// Plugin to provide task to check the current versions of // Plugin to provide task to check the current versions of
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package nl.tudelft.queue.model; package nl.tudelft.queue.model;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -94,5 +95,5 @@ public abstract class LabRequestConstraint { ...@@ -94,5 +95,5 @@ public abstract class LabRequestConstraint {
* *
* @param session The lab to set. * @param session The lab to set.
*/ */
public abstract void setSession(QueueSession<?> session); public abstract void setSession(@NotNull QueueSession<?> session);
} }
...@@ -432,11 +432,9 @@ public class LabService { ...@@ -432,11 +432,9 @@ public class LabService {
*/ */
public long countOngoingLabs(List<Lab> labs) { public long countOngoingLabs(List<Lab> labs) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
return labs.stream().filter(l -> { List<SessionDetailsDTO> sessions = sCache.get(labs.stream().map(QueueSession::getSession));
SessionDetailsDTO session = sCache.getOrThrow(l.getSession()); return sessions.stream().filter(s -> s.getStart().isBefore(now) &&
return session.getStart().isBefore(now) && s.getEnd().isAfter(now)).count();
session.getEnd().isAfter(now);
}).count();
} }
/** /**
...@@ -453,7 +451,7 @@ public class LabService { ...@@ -453,7 +451,7 @@ public class LabService {
case EXAM: case EXAM:
AbstractSlottedLab<TimeSlot> lab = (AbstractSlottedLab<TimeSlot>) l; AbstractSlottedLab<TimeSlot> lab = (AbstractSlottedLab<TimeSlot>) l;
return lab.getSlottedLabConfig().getSelectionOpensAt().isBefore(now) return lab.getSlottedLabConfig().getSelectionOpensAt().isBefore(now)
|| sCache.getOrThrow(lab.getSession()).getStart().isAfter(now); && sCache.getOrThrow(lab.getSession()).getEnd().isAfter(now);
default: default:
return false; return false;
} }
......
...@@ -46,6 +46,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock ...@@ -46,6 +46,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithUserDetails; import org.springframework.security.test.context.support.WithUserDetails;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
...@@ -59,6 +60,7 @@ import test.test.TestQueueApplication; ...@@ -59,6 +60,7 @@ import test.test.TestQueueApplication;
@Transactional @Transactional
@AutoConfigureMockMvc @AutoConfigureMockMvc
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
@SpringBootTest(classes = TestQueueApplication.class) @SpringBootTest(classes = TestQueueApplication.class)
public class SharedEditionControllerTest { public class SharedEditionControllerTest {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment