@@ -3,6 +3,9 @@ import "server-only"
3
3
import { SchedSpeaker , ScheduleSession } from "@/app/conf/2023/types"
4
4
import { readSpeakers } from "../_api/sched-data"
5
5
6
+ const speakersData = require ( "../../../../scripts/sync-sched/speakers.json" )
7
+ const equalitySets : string [ ] [ ] = speakersData . equal || [ ]
8
+
6
9
export const schedule : ScheduleSession [ ] = require ( "../../../../scripts/sync-sched/schedule-2025.json" )
7
10
8
11
type SpeakerUsername = SchedSpeaker [ "username" ]
@@ -32,23 +35,23 @@ export const previousEditionSessions = new Map<
32
35
const schedule2023 = require ( "../../../../scripts/sync-sched/schedule-2023.json" )
33
36
const schedule2024 = require ( "../../../../scripts/sync-sched/schedule-2024.json" )
34
37
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
+ }
44
41
45
- for ( const session of schedule2024 ) {
42
+ function collectSessionsFromPreviousYears ( schedule : ScheduleSession [ ] ) {
43
+ for ( const session of schedule ) {
46
44
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 )
49
54
}
50
-
51
- previousEditionSessions . get ( speaker . username ) ! . push ( session )
52
55
}
53
56
}
54
57
}
0 commit comments