diff --git a/src/components/LeaderboardTeamPitchingTable.vue b/src/components/LeaderboardTeamPitchingTable.vue
index 64ac54d..2da9034 100644
--- a/src/components/LeaderboardTeamPitchingTable.vue
+++ b/src/components/LeaderboardTeamPitchingTable.vue
@@ -27,6 +27,7 @@
WP |
IR |
IRS |
+ IRS% |
WHIP |
H/9 |
HR/9 |
@@ -66,6 +67,7 @@
{{ stat.wp }} |
{{ stat.ir }} |
{{ stat.ir_sc }} |
+ {{ formatIRSPercentage(stat) }} |
{{ stat.whip.toFixed(2) }} |
{{ hitsPer9(stat) }} |
{{ hrsPer9(stat) }} |
@@ -98,6 +100,7 @@
{{ totalPitchingStat.wp }} |
{{ totalPitchingStat.ir }} |
{{ totalPitchingStat.ir_sc }} |
+ {{ formatIRSPercentage(totalPitchingStat) }} |
{{ totalPitchingStat.whip.toFixed(2) }} |
{{ hitsPer9(totalPitchingStat) }} |
{{ hrsPer9(totalPitchingStat) }} |
@@ -162,6 +165,11 @@ export default {
},
hrsPer9(stat: PitchingStat): string {
return hrsPer9(stat)
+ },
+ formatIRSPercentage(stat: PitchingStat): string {
+ if (stat.ir === 0) return '-'
+
+ return `${(stat.ir_sc_pct * 100).toFixed(1)}%`
}
}
}
diff --git a/src/components/PlayerPitchingSummaryTable.vue b/src/components/PlayerPitchingSummaryTable.vue
index 75bd555..8b71169 100644
--- a/src/components/PlayerPitchingSummaryTable.vue
+++ b/src/components/PlayerPitchingSummaryTable.vue
@@ -67,7 +67,7 @@ import { outsToInnings } from '@/services/utilities'
import type { PropType } from 'vue'
export default {
- name: "PlayerPitchingSummaryTable",
+ name: 'PlayerPitchingSummaryTable',
props: {
currentSeasonPitching: { type: Object as PropType, required: false },
currentPostSeasonPitching: { type: Object as PropType, required: false },
diff --git a/src/views/LeaderboardView.vue b/src/views/LeaderboardView.vue
index c324d41..19f57b9 100644
--- a/src/views/LeaderboardView.vue
+++ b/src/views/LeaderboardView.vue
@@ -226,7 +226,8 @@ export default {
{ title: 'Wild Pitches', columnName: 'WP', statPropertyName: 'wp' },
{ title: 'Inherited Runners', columnName: 'IR', statPropertyName: 'ir' },
- { title: 'Inherited Runners Scored', columnName: 'IRS', statPropertyName: 'ir_sc' }
+ { title: 'Inherited Runners Scored', columnName: 'IRS', statPropertyName: 'ir_sc' },
+ { title: 'Inherited Runners Scored %', columnName: 'IRS%', statPropertyName: 'ir_sc_pct' }
]
},
fieldingLeaderboardTableData(): LeaderboardTableData[] {
@@ -284,11 +285,16 @@ export default {
const statBase: BattingStat[] = paExemptStat.includes(stat) ? this.allPlayersBattingStats.concat([]) : this.qualifyingBattingStats.concat([])
const sortMultiplier = this.invertSort ? -1 : 1
- return statBase.sort((a, b) => sortMultiplier * ((b[stat] as number) - (a[stat] as number))).slice(0, 10)
+ return statBase
+ .sort((a, b) =>
+ sortMultiplier * ((b[stat] as number) - (a[stat] as number)) !== 0
+ ? sortMultiplier * ((b[stat] as number) - (a[stat] as number))
+ : b.pa - a.pa)
+ .slice(0, 10)
},
getTop10PitchingStatByCategory(stat: keyof PitchingStat): PitchingStat[] {
// qualifying IP exempt stats
- const ipExemptStats: (keyof PitchingStat)[] = ['win', 'loss', 'save', 'bsave', 'hold', 'so', 'bb', 'hbp', 'hits', 'hr', 'run', 'e_run', 'balk', 'wp', 'ir', 'ir_sc']
+ const ipExemptStats: (keyof PitchingStat)[] = ['win', 'loss', 'save', 'bsave', 'hold', 'so', 'bb', 'hbp', 'hits', 'hr', 'run', 'e_run', 'balk', 'wp', 'ir', 'ir_sc', 'ir_sc_pct']
// concat an empty array so that the existing array is not sorted as a side effect
const statBase: PitchingStat[] = ipExemptStats.includes(stat) ? this.allPlayersPitchingStats.concat([]) : this.qualifyingPitchingStats.concat([])
@@ -301,10 +307,26 @@ export default {
: s.gs === 0
)
- const reverseSortStats = ['era', 'whip', 'bbPer9']
+ const reverseSortStats = ['era', 'whip', 'bbPer9', 'ir_sc_pct']
const sortMultiplier = (reverseSortStats.includes(stat) ? -1 : 1) * (this.invertSort ? -1 : 1)
- return filteredStatBase.sort((a, b) => sortMultiplier * ((b[stat] as number) - (a[stat] as number))).slice(0, 10)
+ // janky workaround for irs% without weird entries
+ if (stat === 'ir_sc_pct') {
+ return filteredStatBase
+ .filter(s => s.ir > 0)
+ .sort((a, b) =>
+ sortMultiplier * ((b[stat] as number) - (a[stat] as number)) !== 0
+ ? sortMultiplier * ((b[stat] as number) - (a[stat] as number))
+ : b.ip - a.ip)
+ .slice(0, 10)
+ }
+
+ return filteredStatBase
+ .sort((a, b) =>
+ sortMultiplier * ((b[stat] as number) - (a[stat] as number)) !== 0
+ ? sortMultiplier * ((b[stat] as number) - (a[stat] as number))
+ : b.ip - a.ip)
+ .slice(0, 10)
},
getTop10FieldingStatByCategory(stat: keyof FlatFieldingStat): FlatFieldingStat[] {
// High: 2B/SS - 2 XCh/wk
@@ -328,9 +350,14 @@ export default {
const xCheckCountProperty = `xCheckCount${position[1]}` as keyof FlatFieldingStat
const sortMultiplier = this.invertSort ? -1 : 1
- return this.allPlayersFieldingStats.concat([])
+ return this.allPlayersFieldingStats
+ .concat([])
.filter(stat => (stat[xCheckCountProperty] as number) >= Math.floor(xCheckCountPerWeek * this.weekNumberForCalcs))
- .sort((a, b) => sortMultiplier * ((b[stat] as number) - (a[stat] as number))).slice(0, 10)
+ .sort((a, b) =>
+ sortMultiplier * ((b[stat] as number) - (a[stat] as number)) !== 0
+ ? sortMultiplier * ((b[stat] as number) - (a[stat] as number))
+ : b.xCheckCount - a.xCheckCount)
+ .slice(0, 10)
}
// non-wF% stats currently won't have any qualifying minimum