Add pitcher decisions and sheet link to GameView
This commit is contained in:
parent
948bce5559
commit
0e4487c7a2
@ -15,9 +15,6 @@
|
||||
<h2 class="text-center">
|
||||
Season {{ seasonNumber }} - Week {{ weekNumber }} - Game {{ gameNumber }}
|
||||
</h2>
|
||||
<h3>
|
||||
<!-- TODO show pitching decisions and link to google sheet if exists -->
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<RouterLink v-if="homeTeamAbbreviation && homeTeamThumbnail"
|
||||
@ -28,6 +25,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pitcher Decisions and Sheet Link -->
|
||||
<div class="row">
|
||||
<h6 style="text-align: center;">
|
||||
{{ pitcherDecisions }}
|
||||
<a v-if="sheetsUrl" target="_blank" :href="sheetsUrl" title="Link to scorecard">
|
||||
🡵
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
<!-- Full Scorecard -->
|
||||
<div class="row" id="scorecard">
|
||||
|
||||
@ -423,6 +430,28 @@ export default {
|
||||
},
|
||||
sheetsUrl(): string | undefined {
|
||||
return this.game?.scorecard_url
|
||||
},
|
||||
pitcherDecisions(): string {
|
||||
const decisions = this.homeTeamPitchingStats.concat(this.awayTeamPitchingStats).filter(ps => ps.win || ps.loss || ps.hold || ps.save || ps.bsave)
|
||||
const win = decisions.find(d => d.win)
|
||||
const loss = decisions.find(d => d.loss)
|
||||
const holds = decisions.filter(d => d.hold)
|
||||
const save = decisions.find(d => d.save)
|
||||
const blownSaves = decisions.filter(d => d.bsave)
|
||||
|
||||
const decisionStrings = []
|
||||
if (win) decisionStrings.push(`Win: ${win.player.name}`)
|
||||
if (loss) decisionStrings.push(`Loss: ${loss.player.name}`)
|
||||
if (holds.length) {
|
||||
decisionStrings.push(`Hold${holds.length > 1 ? 's' : ''}: ${holds.map(h => h.player.name).join(', ')}`)
|
||||
}
|
||||
if (save) decisionStrings.push(`Save: ${save.player.name}`)
|
||||
if (blownSaves.length) {
|
||||
decisionStrings.push(`Blown Save${blownSaves.length > 1 ? 's' : ''}: ${blownSaves.map(h => h.player.name).join(', ')}`)
|
||||
}
|
||||
|
||||
|
||||
return decisionStrings.join(' | ')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user