Add total number of votes/wins for each team in the Splatfest results

This commit is contained in:
Matt Isenhower 2017-12-10 17:16:48 -08:00
parent 9c92314a36
commit a9d46c1600
2 changed files with 20 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<div class="column">
<div class="winner-mark-shadow" v-if="winner == 'alpha'"></div>
<div class="winner-mark" :style="{ background: festival.colors.alpha.css_rgb }" v-if="winner == 'alpha'"></div>
<div class="font-splatoon1 title is-4">
<div class="font-splatoon1 title is-4" :title="alphaTitle | numberFormat">
<div>{{ results.rates[type].alpha }}<span class="percent">{{ $t('splatfest.results.%') }}</span></div>
</div>
</div>
@ -15,7 +15,7 @@
<div class="column">
<div class="winner-mark-shadow" v-if="winner == 'bravo'"></div>
<div class="winner-mark" :style="{ background: festival.colors.bravo.css_rgb }" v-if="winner == 'bravo'"></div>
<div class="font-splatoon1 title is-4">
<div class="font-splatoon1 title is-4" :title="bravoTitle | numberFormat">
<div>{{ results.rates[type].bravo }}<span class="percent">{{ $t('splatfest.results.%') }}</span></div>
</div>
</div>
@ -29,6 +29,19 @@ export default {
winner() {
return this.results.summary[this.type] ? 'bravo' : 'alpha';
},
alphaTitle() {
return this.resultTitle('alpha');
},
bravoTitle() {
return this.resultTitle('bravo');
},
},
methods: {
resultTitle(team) {
if (this.type == 'vote')
return this.results.team_participants[team];
return this.results.team_scores[`${team}_${this.type}`];
},
},
}
</script>

View File

@ -9,6 +9,11 @@ Vue.filter('localSplatNetImageUrl', function(value) {
return 'assets/splatnet' + value;
});
Vue.filter('numberFormat', function(value) {
if (value)
return value.toLocaleString([currentLocale()]);
});
// Short date format (e.g., 8/15 or 15/8)
Vue.filter('date', function(value, options = undefined) {
return (new Date(value * 1000)).toLocaleDateString([currentLocale()], Object.assign({ month: 'numeric', day: 'numeric' }, options));