From 7e5df69d3b4833ae3793f7316aa7166c794e8111 Mon Sep 17 00:00:00 2001 From: Vladyslav Silich <32944269+vkeyboardv@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:04:29 +0300 Subject: [PATCH] Initialize mapStats index before setting singleMapStat properties (#180) * Initialize arrMapString index before setting singleMapStat properties * Rename arrMapString to mapStats --- src/components/PlayerStatTable.vue | 34 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/PlayerStatTable.vue b/src/components/PlayerStatTable.vue index 094a46c..5fd54aa 100644 --- a/src/components/PlayerStatTable.vue +++ b/src/components/PlayerStatTable.vue @@ -8,40 +8,40 @@
- {{ arrMapString[index].score }} - {{ arrMapString[index].map }} + {{ mapStats[index].score }} - {{ mapStats[index].map }}
- {{ arrMapString[index].start }} + {{ mapStats[index].start }}
- {{ arrMapString[index].end }} + {{ mapStats[index].end }}
{{ $t("PlayerStats.Download") }} @@ -49,7 +49,7 @@
@@ -113,7 +113,7 @@ export default { return { playerstats: [], isLoading: true, - arrMapString: [{}], + mapStats: [], allowRefresh: false, timeoutId: -1, isFinished: false, @@ -357,7 +357,11 @@ export default { async retrieveMapStatsHelper(serverResponse, matchData) { if (typeof serverResponse == "string") return; await serverResponse.forEach((singleMapStat, index) => { - this.$set(this.arrMapString[index], 'score', "Score: " + + if (!this.mapStats[index]) { + this.$set(this.mapStats, index, {}); + } + + this.$set(this.mapStats[index], 'score', "Score: " + singleMapStat.team1_score + " " + this.GetScoreSymbol( @@ -366,12 +370,12 @@ export default { ) + " " + singleMapStat.team2_score); - this.$set(this.arrMapString[index], 'start', "Map Start: " + new Date(singleMapStat.start_time).toLocaleString()); - this.$set(this.arrMapString[index], 'end', singleMapStat.end_time == null ? + this.$set(this.mapStats[index], 'start', "Map Start: " + new Date(singleMapStat.start_time).toLocaleString()); + this.$set(this.mapStats[index], 'end', singleMapStat.end_time == null ? null : "Map End: " + new Date(singleMapStat.end_time).toLocaleString()); - this.$set(this.arrMapString[index], 'map', "Map: " + singleMapStat.map_name); - this.$set(this.arrMapString[index], 'demo', singleMapStat.demoFile); + this.$set(this.mapStats[index], 'map', "Map: " + singleMapStat.map_name); + this.$set(this.mapStats[index], 'demo', singleMapStat.demoFile); }); if (matchData.end_time != null) this.isFinished = true; }