Add to player career pitching table

This commit is contained in:
Peter 2024-11-01 13:14:55 -05:00
parent 78e3dae91c
commit 61c14786dc

View File

@ -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>
@ -37,7 +38,7 @@
</tr>
</thead>
<tbody id="career-pitching-table">
<tr v-for="stat in sortedRegularAndPostSeasonPitching">
<tr v-for="stat in sortedRegularAndPostSeasonPitching" :key="stat.seasonNumber">
<td>S{{ stat.seasonNumber }}{{ stat.isRegularSeason ? '' : ' / Playoffs' }}</td>
<td>{{ stat.win }}</td>
<td>{{ stat.loss }}</td>
@ -60,6 +61,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>
@ -69,7 +71,7 @@
</tr>
</tbody>
<tfoot>
<tr v-for="(stat, idx) in careerPitchingStats">
<tr v-for="(stat, idx) in careerPitchingStats" :key="idx">
<th>Career{{ idx > 0 ? ' / Playoffs' : '' }}</th>
<th>{{ stat.win }}</th>
<th>{{ stat.loss }}</th>
@ -92,6 +94,7 @@
<th>{{ stat.wp }}</th>
<th>{{ stat.ir }}</th>
<th>{{ stat.ir_sc }}</th>
<th>{{ formatIRSPercentage(stat) }}</th>
<th>{{ stat.whip.toFixed(2) }}</th>
<th>{{ hitsPer9(stat) }}</th>
<th>{{ hrsPer9(stat) }}</th>
@ -116,7 +119,7 @@ interface PitchingStatWithSeason extends PitchingStat {
}
export default {
name: "PlayerCareerPitchingTable",
name: 'PlayerCareerPitchingTable',
props: {
regularSeasonPitchingStats: { type: Array<PitchingStat>, required: true },
postSeasonPitchingStats: { type: Array<PitchingStat>, required: true },
@ -191,6 +194,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)}%`
}
}
}