From b25118ccb55e2a2281e07e862045510c6c6dc5e8 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 20 Feb 2025 09:16:16 -0600 Subject: [PATCH] Fix standings sort --- src/components/StandingsTable.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/StandingsTable.vue b/src/components/StandingsTable.vue index a55ef88..ab7d52f 100644 --- a/src/components/StandingsTable.vue +++ b/src/components/StandingsTable.vue @@ -12,12 +12,11 @@ - + - {{ - team.teamName }} + {{ team.teamName }} {{ record(team) }} @@ -48,6 +47,16 @@ export default { required: true } }, + computed: { + sortedTeams(): TeamStanding[] { + if (!this.teams) return [] + return this.teams.slice() + .sort((t1, t2) => + (t2.wins - t2.losses) !== (t1.wins - t1.losses) + ? (t2.wins - t2.losses) - (t1.wins - t1.losses) + : (t2.wins + t2.losses) - (t1.wins + t1.losses)) + } + }, methods: { eliminationNumber(teamStanding: TeamStanding): string { return this.isDivisional ? teamStanding.divisionEliminationNumber : teamStanding.wildcardEliminationNumber