Skip to content

Commit 428613a

Browse files
author
marcselman
committed
Update session status logic to show upcoming sessions per room
Modifies the `findNextSessions` function in `client/src/pages/Kiosk.tsx` to determine "Aankomend" sessions on a per-room basis, rather than globally. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9b278ad5-3a45-420e-ba83-0847baf9924f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 7a9a05db-2382-48f2-8cb2-b8b47333563e Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/04133160-d2cd-42c9-82f0-4e08d800b951/9b278ad5-3a45-420e-ba83-0847baf9924f/R7QqjaK Replit-Helium-Checkpoint-Created: true
1 parent c15c34b commit 428613a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

client/src/pages/Kiosk.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ function getSessionStatus(session: KioskSession, now: Date): SessionStatus {
124124
}
125125

126126
function findNextSessions(sessions: KioskSession[], now: Date): Set<string> {
127-
const futureSessions = sessions
128-
.filter(s => new Date(s.startTime) > now)
129-
.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime());
127+
const rooms = [...new Set(sessions.map(s => s.room))];
128+
const nextIds = new Set<string>();
130129

131-
if (futureSessions.length === 0) return new Set();
130+
for (const room of rooms) {
131+
const futureSessions = sessions
132+
.filter(s => s.room === room && new Date(s.startTime) > now)
133+
.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime());
132134

133-
const earliestStart = new Date(futureSessions[0].startTime).getTime();
134-
const nextIds = new Set<string>();
135-
for (const s of futureSessions) {
136-
if (new Date(s.startTime).getTime() === earliestStart) {
137-
nextIds.add(s.id);
135+
if (futureSessions.length > 0) {
136+
nextIds.add(futureSessions[0].id);
138137
}
139138
}
139+
140140
return nextIds;
141141
}
142142

0 commit comments

Comments
 (0)