Fix bug on team view sub-components
This commit is contained in:
parent
66058ff359
commit
057be7ae00
@ -135,6 +135,12 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
teamId(newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue)
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData(): Promise<void> {
|
async fetchData(): Promise<void> {
|
||||||
const unsortedBattingStats: BattingStat[] = await fetchBattingStatsBySeasonAndTeamId(this.seasonNumber, this.teamId, this.isRegularSeason)
|
const unsortedBattingStats: BattingStat[] = await fetchBattingStatsBySeasonAndTeamId(this.seasonNumber, this.teamId, this.isRegularSeason)
|
||||||
|
|||||||
@ -88,10 +88,16 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
teamId(newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue)
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData(): Promise<void> {
|
async fetchData(): Promise<void> {
|
||||||
const unsortedFieldingStats: FieldingStat[] = await fetchFieldingStatsBySeasonAndTeamId(this.seasonNumber, this.teamId, this.isRegularSeason)
|
const unsortedFieldingStats: FieldingStat[] = await fetchFieldingStatsBySeasonAndTeamId(this.seasonNumber, this.teamId, this.isRegularSeason)
|
||||||
this.fieldingStats = unsortedFieldingStats.sort((s1, s2) => POS_MAP[s1.pos] - POS_MAP[s2.pos])
|
this.fieldingStats = unsortedFieldingStats.sort((s1, s2) => s2.xCheckCount - s1.xCheckCount)
|
||||||
},
|
},
|
||||||
formatCaughtStealingPercent(stat: FieldingStat): string {
|
formatCaughtStealingPercent(stat: FieldingStat): string {
|
||||||
if (stat.stolenBaseCheckCount === 0 || Number.isNaN(stat.caughtStealingPercent)) {
|
if (stat.stolenBaseCheckCount === 0 || Number.isNaN(stat.caughtStealingPercent)) {
|
||||||
|
|||||||
@ -141,6 +141,12 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
teamId(newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue)
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData(): Promise<void> {
|
async fetchData(): Promise<void> {
|
||||||
const unsortedPitchingStats: PitchingStat[] = await fetchPitchingStatsBySeasonAndTeamId(this.seasonNumber, this.teamId, this.isRegularSeason)
|
const unsortedPitchingStats: PitchingStat[] = await fetchPitchingStatsBySeasonAndTeamId(this.seasonNumber, this.teamId, this.isRegularSeason)
|
||||||
|
|||||||
@ -88,7 +88,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -136,6 +135,12 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
teamId(newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue)
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
makeScheduleRowsFromGames(games: Game[]): ScheduleRow[] {
|
makeScheduleRowsFromGames(games: Game[]): ScheduleRow[] {
|
||||||
const gamesByWeekAndHomeTeam = this.groupByWeekAndHomeTeam(games)
|
const gamesByWeekAndHomeTeam = this.groupByWeekAndHomeTeam(games)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user