Skip to content

Commit 3646a5d

Browse files
committed
Track duplicate speakers
1 parent 3df2606 commit 3646a5d

File tree

2 files changed

+74
-19
lines changed

2 files changed

+74
-19
lines changed

scripts/sync-sched/speakers.json

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,28 @@
55
"christian.ernst1"
66
],
77
[
8-
"dotansimha",
9-
"dotan1"
8+
"dotan1",
9+
"dotansimha"
10+
],
11+
[
12+
"janette.cheng",
13+
"janettelc"
14+
],
15+
[
16+
"jordaneldredge",
17+
"jordaneldredge1"
18+
],
19+
[
20+
"lee_byron.25jvpjmb",
21+
"lee_byron.25krdom6"
22+
],
23+
[
24+
"pooja.mistry",
25+
"pooja.mistry1"
26+
],
27+
[
28+
"saihaj",
29+
"saihajpreet.singh"
1030
]
1131
],
1232
"speakers": [
@@ -92,7 +112,7 @@
92112
"_years": [
93113
2025
94114
],
95-
"~syncedDetailsAt": 1750090472229
115+
"~syncedDetailsAt": 1750182397854
96116
},
97117
{
98118
"username": "ajhingran",
@@ -231,7 +251,7 @@
231251
"_years": [
232252
2025
233253
],
234-
"~syncedDetailsAt": 1750090472229
254+
"~syncedDetailsAt": 1750182397854
235255
},
236256
{
237257
"username": "amy1908",
@@ -1071,7 +1091,7 @@
10711091
"_years": [
10721092
2025
10731093
],
1074-
"~syncedDetailsAt": 1750090472229
1094+
"~syncedDetailsAt": 1750182478137
10751095
},
10761096
{
10771097
"username": "gabe210",
@@ -1382,7 +1402,7 @@
13821402
"_years": [
13831403
2025
13841404
],
1385-
"~syncedDetailsAt": 1750090472229
1405+
"~syncedDetailsAt": 1750182512347
13861406
},
13871407
{
13881408
"username": "jeff.auriemma",
@@ -1482,7 +1502,7 @@
14821502
"_years": [
14831503
2025
14841504
],
1485-
"~syncedDetailsAt": 1750090472229
1505+
"~syncedDetailsAt": 1750182512347
14861506
},
14871507
{
14881508
"username": "jim.barton",
@@ -1946,7 +1966,7 @@
19461966
"_years": [
19471967
2025
19481968
],
1949-
"~syncedDetailsAt": 1750090472229
1969+
"~syncedDetailsAt": 1750182463095
19501970
},
19511971
{
19521972
"username": "marco.reni",
@@ -1966,7 +1986,7 @@
19661986
"_years": [
19671987
2025
19681988
],
1969-
"~syncedDetailsAt": 1750090472229
1989+
"~syncedDetailsAt": 1750182515121
19701990
},
19711991
{
19721992
"username": "marion84",
@@ -2095,7 +2115,7 @@
20952115
"_years": [
20962116
2025
20972117
],
2098-
"~syncedDetailsAt": 1750090472229
2118+
"~syncedDetailsAt": 1750182515122
20992119
},
21002120
{
21012121
"username": "mauricio.montalvo.guzman",
@@ -2500,7 +2520,7 @@
25002520
2024,
25012521
2025
25022522
],
2503-
"~syncedDetailsAt": 1750079535203
2523+
"~syncedDetailsAt": 1750181915102
25042524
},
25052525
{
25062526
"username": "ruben.cagnie",
@@ -2531,7 +2551,7 @@
25312551
2024,
25322552
2025
25332553
],
2534-
"~syncedDetailsAt": 1750079535203
2554+
"~syncedDetailsAt": 1750181953774
25352555
},
25362556
{
25372557
"username": "saihaj",
@@ -2600,7 +2620,7 @@
26002620
"_years": [
26012621
2025
26022622
],
2603-
"~syncedDetailsAt": 1750090472229
2623+
"~syncedDetailsAt": 1750182463095
26042624
},
26052625
{
26062626
"username": "sasanders26",
@@ -2815,7 +2835,7 @@
28152835
2024,
28162836
2025
28172837
],
2818-
"~syncedDetailsAt": 1750079535203
2838+
"~syncedDetailsAt": 1750181966765
28192839
},
28202840
{
28212841
"username": "stefan239",
@@ -3026,7 +3046,7 @@
30263046
"_years": [
30273047
2025
30283048
],
3029-
"~syncedDetailsAt": 1750090472229
3049+
"~syncedDetailsAt": 1750182478137
30303050
},
30313051
{
30323052
"username": "tushar.mathur",
@@ -3101,7 +3121,7 @@
31013121
2024,
31023122
2025
31033123
],
3104-
"~syncedDetailsAt": 1750079535203
3124+
"~syncedDetailsAt": 1750181973559
31053125
},
31063126
{
31073127
"username": "vincent.desmares",
@@ -3278,4 +3298,4 @@
32783298
"~syncedDetailsAt": 1750167799402
32793299
}
32803300
]
3281-
}
3301+
}

scripts/sync-sched/sync.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,16 @@ async function sync(
143143
}
144144
}
145145

146-
const equal: string[][] = (await existingSpeakers).equal
147-
148146
const updatedSpeakers = [
149147
...keptRemovedSpeakers,
150148
...speakerComparison.unchanged,
151149
...speakerComparison.changed.map(change => change.new),
152150
...speakerComparison.added,
153151
].sort((a, b) => a.username.localeCompare(b.username))
154152

153+
const equal: string[][] = (await existingSpeakers).equal
154+
updateEqualitySets(equal, updatedSpeakers)
155+
155156
const writeSpeakers = writeFile(
156157
speakersFilePath,
157158
JSON.stringify(
@@ -281,6 +282,40 @@ function partitionRemovedSpeakers(
281282
return { keptRemovedSpeakers, actuallyRemovedSpeakers }
282283
}
283284

285+
type EqualitySet = string[][]
286+
287+
function updateEqualitySets(old: EqualitySet, speakers: SchedSpeaker[]) {
288+
for (const a of speakers) {
289+
for (const b of speakers) {
290+
if (a.username === b.username) continue
291+
292+
// if the name or one of the social URLs is the same we add the username to a set
293+
if (
294+
a.name === b.name ||
295+
a.socialurls?.some(url =>
296+
b.socialurls?.some(bUrl => bUrl.url === url.url),
297+
)
298+
) {
299+
const existing = old.find(
300+
set => set.includes(a.username) || set.includes(b.username),
301+
)
302+
if (existing) {
303+
const length = existing.length
304+
const newSet = [...new Set([...existing, a.username, b.username])]
305+
if (newSet.length !== length) {
306+
existing.length = 0
307+
existing.push(...newSet)
308+
console.log("Found more duplicate speakers:", newSet)
309+
}
310+
} else {
311+
old.push([a.username, b.username])
312+
console.log("Found duplicate speakers:", a.username, b.username)
313+
}
314+
}
315+
}
316+
}
317+
}
318+
284319
// #region utility
285320

286321
type Change<T> = { old: T; new: T }

0 commit comments

Comments
 (0)