From ac4f691c921f6bd272df0603e06ad89ac5b811d5 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Fri, 27 Nov 2020 09:53:13 +0100 Subject: [PATCH] Added 5 minutes to the range of events to get Signed-off-by: Louis Vallat --- DatabaseSetup.sql | 1 - .../java/xyz/vallat/louis/managers/database/EventManager.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/DatabaseSetup.sql b/DatabaseSetup.sql index bfbe701..16e55e2 100644 --- a/DatabaseSetup.sql +++ b/DatabaseSetup.sql @@ -21,4 +21,3 @@ CREATE TABLE IF NOT EXISTS events REFERENCES students (id) ON DELETE CASCADE ); - diff --git a/app/src/main/java/xyz/vallat/louis/managers/database/EventManager.java b/app/src/main/java/xyz/vallat/louis/managers/database/EventManager.java index 63a3e1b..0048c9c 100644 --- a/app/src/main/java/xyz/vallat/louis/managers/database/EventManager.java +++ b/app/src/main/java/xyz/vallat/louis/managers/database/EventManager.java @@ -85,7 +85,7 @@ public final class EventManager { public static List getNextEventsFromStudent(Student s) { logger.debug("Getting events from student '{}'.", s.getSnowflake()); String sql = "SELECT id, summary, start_event, end_event" + - " FROM events WHERE students_id = ? AND start_event >= NOW();"; + " FROM events WHERE students_id = ? AND (start_event + interval '5 minutes') >= NOW();"; List events = new ArrayList<>(); try (Connection connection = DBManager.getConnection()) { try (PreparedStatement stmt = connection.prepareStatement(sql)) {