Skip to content

Commit 0541c89

Browse files
committed
Collect sessions from previous years even if the username is different
1 parent f621124 commit 0541c89

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/app/conf/2025/_data.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import "server-only"
33
import { SchedSpeaker, ScheduleSession } from "@/app/conf/2023/types"
44
import { readSpeakers } from "../_api/sched-data"
55

6+
const speakersData = require("../../../../scripts/sync-sched/speakers.json")
7+
const equalitySets: string[][] = speakersData.equal || []
8+
69
export const schedule: ScheduleSession[] = require("../../../../scripts/sync-sched/schedule-2025.json")
710

811
type SpeakerUsername = SchedSpeaker["username"]
@@ -32,23 +35,23 @@ export const previousEditionSessions = new Map<
3235
const schedule2023 = require("../../../../scripts/sync-sched/schedule-2023.json")
3336
const schedule2024 = require("../../../../scripts/sync-sched/schedule-2024.json")
3437

35-
for (const session of schedule2023) {
36-
for (const speaker of session.speakers || []) {
37-
if (!previousEditionSessions.has(speaker.username)) {
38-
previousEditionSessions.set(speaker.username, [])
39-
}
40-
41-
previousEditionSessions.get(speaker.username)!.push(session)
42-
}
43-
}
38+
collectSessionsFromPreviousYears(schedule2023)
39+
collectSessionsFromPreviousYears(schedule2024)
40+
}
4441

45-
for (const session of schedule2024) {
42+
function collectSessionsFromPreviousYears(schedule: ScheduleSession[]) {
43+
for (const session of schedule) {
4644
for (const speaker of session.speakers || []) {
47-
if (!previousEditionSessions.has(speaker.username)) {
48-
previousEditionSessions.set(speaker.username, [])
45+
const duplicates = equalitySets.find(set =>
46+
set.includes(speaker.username),
47+
)
48+
49+
for (const username of duplicates || [speaker.username]) {
50+
if (!previousEditionSessions.has(username)) {
51+
previousEditionSessions.set(username, [])
52+
}
53+
previousEditionSessions.get(username)!.push(session)
4954
}
50-
51-
previousEditionSessions.get(speaker.username)!.push(session)
5255
}
5356
}
5457
}

0 commit comments

Comments
 (0)