diff --git a/src/main/java/swiss/fihlon/apus/plugin/event/EventService.java b/src/main/java/swiss/fihlon/apus/plugin/event/EventService.java index 66db3dd..1e7c9bf 100644 --- a/src/main/java/swiss/fihlon/apus/plugin/event/EventService.java +++ b/src/main/java/swiss/fihlon/apus/plugin/event/EventService.java @@ -45,7 +45,6 @@ public final class EventService { private final List eventPlugins; private final ScheduledFuture updateScheduler; private final Period dateAdjust; - private final boolean showClosedRooms; private Map> roomsWithSessions = new TreeMap<>(); public EventService(@NotNull final TaskScheduler taskScheduler, @@ -53,7 +52,6 @@ public EventService(@NotNull final TaskScheduler taskScheduler, @NotNull final List eventPlugins) { this.eventPlugins = eventPlugins; this.dateAdjust = configuration.getEvent().dateAdjust(); - this.showClosedRooms = configuration.getEvent().showClosedRooms(); if (isEnabled()) { updateSessions(); final var updateFrequency = Duration.ofMinutes(configuration.getEvent().updateFrequency()); @@ -103,9 +101,6 @@ private void updateSessions() { } synchronized (this) { - if (!showClosedRooms) { - newRoomsWithSessions.entrySet().removeIf(entry -> entry.getValue().isEmpty()); - } roomsWithSessions = newRoomsWithSessions; } } catch (final SessionImportException e) { diff --git a/src/main/java/swiss/fihlon/apus/ui/view/EventView.java b/src/main/java/swiss/fihlon/apus/ui/view/EventView.java index eea6b2e..2b0cb6b 100644 --- a/src/main/java/swiss/fihlon/apus/ui/view/EventView.java +++ b/src/main/java/swiss/fihlon/apus/ui/view/EventView.java @@ -51,6 +51,7 @@ public final class EventView extends Div { private final transient EventService eventService; private final Duration nextSessionTimeout; private final boolean showLegend; + private final boolean showClosedRooms; private final Div roomContainer = new Div(); private final Span legend = new Span(); @@ -60,6 +61,7 @@ public EventView(@NotNull final EventService eventService, this.eventService = eventService; this.nextSessionTimeout = Duration.ofMinutes(configuration.getEvent().nextSessionTimeout()); this.showLegend = configuration.getEvent().showLegend(); + this.showClosedRooms = configuration.getEvent().showClosedRooms(); setId("event-view"); add(createTitle()); if (showLegend) { @@ -91,6 +93,9 @@ private void updateConferenceSessions() { final var roomStylesInUse = new HashSet(); for (final Map.Entry> roomWithSession : roomsWithSessions) { final RoomView roomView = createRoomView(roomWithSession, today); + if (!showClosedRooms && RoomStyle.EMPTY.equals(roomView.getRoomStyle())) { + continue; // don't show empty rooms when configured to do so + } roomStylesInUse.add(roomView.getRoomStyle()); roomContainer.add(roomView); }