Skip to content

Commit

Permalink
Don't allow selecting players with a unique W/D/L record for a play-off
Browse files Browse the repository at this point in the history
  • Loading branch information
phrasmotica committed Apr 27, 2024
1 parent e5ed30b commit 1adcc84
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/results/PlayerSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { usePlayers } from "@/composables/usePlayers"
import { useScreenSizes } from "@/composables/useScreenSizes"
import { usePhaseSpecification } from "@/composables/useSpecification"
import type { PlayerRecord } from "@/data/PlayerRecord"
import { useFlyerStore } from "@/stores/flyer"
const playerIds = defineModel<string[]>({
Expand Down Expand Up @@ -41,11 +42,19 @@ const options = computed(() => {
return {
...getPlayer(s.playerId)!,
disabled: hasAlreadyPlayedOff(s.playerId),
disabled: isUniqueRecord(s) || hasAlreadyPlayedOff(s.playerId),
record: record.join("-"),
}
})
})
const isUniqueRecord = (s: PlayerRecord) => {
return overallStandings.value.filter(x => {
return x.wins === s.wins
&& x.draws === s.draws
&& x.losses === s.losses
}).length === 1
}
</script>

<template>
Expand Down

0 comments on commit 1adcc84

Please sign in to comment.