diff --git a/src/views/TeamLeaderboardView.vue b/src/views/TeamLeaderboardView.vue index f3c438c..b4ba18b 100644 --- a/src/views/TeamLeaderboardView.vue +++ b/src/views/TeamLeaderboardView.vue @@ -3,7 +3,6 @@

Season {{ seasonNumber }} Team Stats

-

Week {{ weekNumber }}

{{ statType }} Stats

@@ -29,8 +28,7 @@ import LeaderboardTeamBattingTable from '@/components/LeaderboardTeamBattingTable.vue' import LeaderboardTeamFieldingTable from '@/components/LeaderboardTeamFieldingTable.vue' import LeaderboardTeamPitchingTable from '@/components/LeaderboardTeamPitchingTable.vue' -import { type LeagueInfo, fetchCurrentLeagueInfo } from '@/services/currentService' -import { CURRENT_SEASON, GAMES_PER_WEEK, MODERN_STAT_ERA_START, WEEKS_PER_SEASON } from '@/services/utilities' +import { CURRENT_SEASON, MODERN_STAT_ERA_START } from '@/services/utilities' export default { name: 'TeamLeaderboardView', @@ -44,9 +42,6 @@ export default { currentSeasonNumber: CURRENT_SEASON, seasonNumber: CURRENT_SEASON, statType: 'Batting' as 'Batting' | 'Pitching' | 'Fielding', - pitchingType: 'All' as 'All' | 'Starters' | 'Relievers', - - weekNumber: undefined! as number } }, computed: { @@ -54,54 +49,6 @@ export default { if (!this.currentSeasonNumber) return [] return Array.from({ length: this.currentSeasonNumber - MODERN_STAT_ERA_START + 1 }, (_, i) => i + MODERN_STAT_ERA_START) }, - weekNumberForCalcs(): number { - if (this.seasonNumber < this.currentSeasonNumber) return WEEKS_PER_SEASON - // since stats are for regular season, do not use post season weeks to up PA/IP mins - return Math.max(0, Math.min(this.weekNumber, WEEKS_PER_SEASON)) - }, - statMinimum(): string { - if (this.statType == 'Batting') return `PA: ${this.plateAppearanceMinimum}` - if (this.statType == 'Pitching') return `IP: ${this.inningsPitchedMinimum}` - return `${Math.floor(this.weekNumberForCalcs * 2)}/${Math.floor(this.weekNumberForCalcs)}/${Math.floor(this.weekNumberForCalcs * 0.5)}/${Math.floor(this.weekNumberForCalcs * 0.25)}` - }, - plateAppearanceMinimum(): number { - const MIN_PLATE_APPEARANCES_PER_GAME = 3 - return this.weekNumberForCalcs * GAMES_PER_WEEK * MIN_PLATE_APPEARANCES_PER_GAME - }, - inningsPitchedMinimum(): number { - if (this.pitchingType === 'Relievers') return this.weekNumberForCalcs - - const MIN_IP_PER_GAME = 1 - return this.weekNumberForCalcs * GAMES_PER_WEEK * MIN_IP_PER_GAME - }, - }, - created() { - this.fetchData() - }, - watch: { - seasonNumber(newValue, oldValue) { - if (newValue !== oldValue) - this.fetchData() - }, - statType(newValue, oldValue) { - if (newValue !== oldValue) - this.fetchData() - } - }, - methods: { - async fetchData(): Promise { - const leagueInfo: LeagueInfo = await fetchCurrentLeagueInfo() - this.weekNumber = leagueInfo.week - } } } - - \ No newline at end of file