Added 5 minutes to the range of events to get

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2020-11-27 09:53:13 +01:00
parent 45e0fca849
commit ac4f691c92
2 changed files with 1 additions and 2 deletions

View File

@ -21,4 +21,3 @@ CREATE TABLE IF NOT EXISTS events
REFERENCES students (id) REFERENCES students (id)
ON DELETE CASCADE ON DELETE CASCADE
); );

View File

@ -85,7 +85,7 @@ public final class EventManager {
public static List<Event> getNextEventsFromStudent(Student s) { public static List<Event> getNextEventsFromStudent(Student s) {
logger.debug("Getting events from student '{}'.", s.getSnowflake()); logger.debug("Getting events from student '{}'.", s.getSnowflake());
String sql = "SELECT id, summary, start_event, end_event" + 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<Event> events = new ArrayList<>(); List<Event> events = new ArrayList<>();
try (Connection connection = DBManager.getConnection()) { try (Connection connection = DBManager.getConnection()) {
try (PreparedStatement stmt = connection.prepareStatement(sql)) { try (PreparedStatement stmt = connection.prepareStatement(sql)) {