diff --git a/src/views/LeaderboardView.vue b/src/views/LeaderboardView.vue index 1ea9de2..e45f5db 100644 --- a/src/views/LeaderboardView.vue +++ b/src/views/LeaderboardView.vue @@ -263,6 +263,9 @@ export default { return this.getTop10FieldingStatByCategory(stat as keyof FlatFieldingStat) }, getTop10BattingStatByCategory(stat: keyof BattingStat): BattingStat[] { + if (['sb', 'cs'].includes(stat)) { + return this.allPlayersBattingStats.concat([]).sort((a, b) => (b[stat] as number) - (a[stat] as number)).slice(0, 10) + } // concat an empty array so that the existing array is not sorted as a side effect return this.qualifyingBattingStats.concat([]).sort((a, b) => (b[stat] as number) - (a[stat] as number)).slice(0, 10) },