hide players with scores from add score dropdown

This commit is contained in:
Justin Edmund 2025-12-18 00:36:13 -08:00
parent cefcdfef07
commit b4ede07bcd

View file

@ -219,29 +219,30 @@
}) })
// Player options for dropdown - members first, then phantoms // Player options for dropdown - members first, then phantoms
// Excludes players who already have scores for this event
const playerOptions = $derived.by(() => { const playerOptions = $derived.by(() => {
const options: Array<{ value: string; label: string; suffix?: string; muted?: boolean }> = [] const options: Array<{ value: string; label: string; suffix?: string }> = []
// Add members // Add members (skip those with scores)
for (const m of membersDuringEvent) { for (const m of membersDuringEvent) {
if (m.user) { if (m.user) {
const hasScore = playersWithScores.has(`member:${m.id}`) const hasScore = playersWithScores.has(`member:${m.id}`)
if (hasScore) continue
options.push({ options.push({
value: `member:${m.id}`, value: `member:${m.id}`,
label: m.user.username + (m.retired ? ' (Retired)' : ''), label: m.user.username + (m.retired ? ' (Retired)' : '')
muted: hasScore
}) })
} }
} }
// Add phantoms // Add phantoms (skip those with scores)
for (const p of phantomPlayers) { for (const p of phantomPlayers) {
const hasScore = playersWithScores.has(`phantom:${p.id}`) const hasScore = playersWithScores.has(`phantom:${p.id}`)
if (hasScore) continue
options.push({ options.push({
value: `phantom:${p.id}`, value: `phantom:${p.id}`,
label: p.name + (p.retired ? ' (Retired)' : ''), label: p.name + (p.retired ? ' (Retired)' : ''),
suffix: 'Phantom', suffix: 'Phantom'
muted: hasScore
}) })
} }