Add IRS% to team page
This commit is contained in:
parent
0e273f4d2c
commit
78e3dae91c
@ -28,6 +28,7 @@
|
||||
<th>WP</th>
|
||||
<th>IR</th>
|
||||
<th>IRS</th>
|
||||
<th>IRS%</th>
|
||||
<th>WHIP</th>
|
||||
<th>H/9</th>
|
||||
<th>HR/9</th>
|
||||
@ -67,6 +68,7 @@
|
||||
<td>{{ stat.wp }}</td>
|
||||
<td>{{ stat.ir }}</td>
|
||||
<td>{{ stat.ir_sc }}</td>
|
||||
<td>{{ formatIRSPercentage(stat) }}</td>
|
||||
<td>{{ stat.whip.toFixed(2) }}</td>
|
||||
<td>{{ hitsPer9(stat) }}</td>
|
||||
<td>{{ hrsPer9(stat) }}</td>
|
||||
@ -99,6 +101,7 @@
|
||||
<th>{{ totalPitchingStat.wp }}</th>
|
||||
<th>{{ totalPitchingStat.ir }}</th>
|
||||
<th>{{ totalPitchingStat.ir_sc }}</th>
|
||||
<th>{{ formatIRSPercentage(totalPitchingStat) }}</th>
|
||||
<th>{{ totalPitchingStat.whip.toFixed(2) }}</th>
|
||||
<th>{{ hitsPer9(totalPitchingStat) }}</th>
|
||||
<th>{{ hrsPer9(totalPitchingStat) }}</th>
|
||||
@ -163,6 +166,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)}%`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ export interface PitchingStat {
|
||||
bsave: number
|
||||
ir: number
|
||||
ir_sc: number
|
||||
ir_sc_pct: number
|
||||
ab: number
|
||||
run: number
|
||||
e_run: number
|
||||
@ -273,6 +274,7 @@ export function aggregatePitchingStats(pitchingStats: PitchingStat[]): PitchingS
|
||||
bsave: 0,
|
||||
ir: 0,
|
||||
ir_sc: 0,
|
||||
ir_sc_pct: 0,
|
||||
ab: 0,
|
||||
run: 0,
|
||||
e_run: 0,
|
||||
@ -350,6 +352,7 @@ export function aggregatePitchingStats(pitchingStats: PitchingStat[]): PitchingS
|
||||
|
||||
return {
|
||||
...totalStat,
|
||||
ir_sc_pct: irsPercentage(totalStat),
|
||||
era: eraFromOuts(totalStat),
|
||||
whip: whipFromOuts(totalStat),
|
||||
kPer9: kPer9FromOuts(totalStat),
|
||||
@ -397,6 +400,7 @@ function makeModernPitchingStatFromLegacy(legacyStat: LegacyPitchingStat): Pitch
|
||||
kPer9: kPer9(legacyStat),
|
||||
bbPer9: bbPer9(legacyStat),
|
||||
kPerBB: kPerBB(legacyStat),
|
||||
ir_sc_pct: irsPercentage({ ir: legacyStat.ir, ir_sc: legacyStat.irs }),
|
||||
|
||||
// no easy way to get below values from legacy stats afaik
|
||||
tbf: 0,
|
||||
@ -438,6 +442,7 @@ function normalizePitchingStat(rawStat: PitchingStatRaw): PitchingStat {
|
||||
bsave: rawStat.bsave,
|
||||
ir: rawStat.ir,
|
||||
ir_sc: rawStat.ir_sc,
|
||||
ir_sc_pct: irsPercentage(rawStat),
|
||||
ab: rawStat.ab,
|
||||
run: rawStat.run,
|
||||
e_run: rawStat.e_run,
|
||||
@ -528,3 +533,7 @@ function kPerBB(stat: { so: number, bb: number }): number {
|
||||
return stat.so / stat.bb
|
||||
}
|
||||
|
||||
function irsPercentage(stat: { ir: number, ir_sc: number }): number {
|
||||
return stat.ir === 0 ? 0 : stat.ir_sc / stat.ir
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user