From 159857746165b0618b74af17a8d26d72577027c4 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 26 Jul 2023 04:47:21 +0100 Subject: [PATCH] Update match head-to-head history to show scheduled but not played maps --- .../components/website/match/MatchMapHistory.vue | 4 ++-- .../src/components/website/match/TeamMapStats.vue | 10 +++++++--- website/src/utils/content-utils.js | 9 +++++++-- website/src/views/sub-views/MatchHistory.vue | 14 +++++++++----- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/website/src/components/website/match/MatchMapHistory.vue b/website/src/components/website/match/MatchMapHistory.vue index 0a0aa3d3..440dda58 100644 --- a/website/src/components/website/match/MatchMapHistory.vue +++ b/website/src/components/website/match/MatchMapHistory.vue @@ -4,7 +4,7 @@ {{ map.name }} - @@ -19,7 +19,7 @@ export default { VBTooltip }, components: { TeamMapStats }, - props: ["data", "map"], + props: ["data", "map", "showUnplayedMaps"], computed: { isScheduled() { return this.data?.meta?.scheduledForMatch; diff --git a/website/src/components/website/match/TeamMapStats.vue b/website/src/components/website/match/TeamMapStats.vue index 5a00e8f2..3e327c31 100644 --- a/website/src/components/website/match/TeamMapStats.vue +++ b/website/src/components/website/match/TeamMapStats.vue @@ -4,9 +4,9 @@
{{ scoreline }}
-
+
Unplayed: {{ stats.unplayed }}
+
- @@ -17,7 +17,7 @@ import { VBTooltip } from "bootstrap-vue"; export default { name: "TeamMapStats", components: { ThemeLogo }, - props: ["data"], + props: ["data", "showUnplayedMaps"], directives: { VBTooltip }, @@ -53,4 +53,8 @@ export default { .recent { margin: 0 0.2em; } + .stat.unplayed { + min-width: 6em; + text-align: center; + } diff --git a/website/src/utils/content-utils.js b/website/src/utils/content-utils.js index 42260f8a..71d903f9 100644 --- a/website/src/utils/content-utils.js +++ b/website/src/utils/content-utils.js @@ -253,7 +253,8 @@ export function getTeamsMapStats(teams, requestMatch, requestMap, filters) { played: 0, wins: 0, losses: 0, - draws: 0 + draws: 0, + unplayed: 0 }; const prevMatches = (team.matches || []) @@ -284,7 +285,11 @@ export function getTeamsMapStats(teams, requestMatch, requestMap, filters) { if (scheduledMap) stat.scheduled_for_match = true; } - if (!(matchMap.draw || matchMap.winner)) return; // wasn't played fully + if (!(matchMap.draw || matchMap.winner || matchMap.banner)) { + // wasn't played fully + if ([match.score_1, match.score_2].includes(match.first_to)) stat.unplayed++; + return; + } // woo right map diff --git a/website/src/views/sub-views/MatchHistory.vue b/website/src/views/sub-views/MatchHistory.vue index 1e1d304b..246c7492 100644 --- a/website/src/views/sub-views/MatchHistory.vue +++ b/website/src/views/sub-views/MatchHistory.vue @@ -1,12 +1,15 @@