Skip to content

Commit

Permalink
Initialize mapStats index before setting singleMapStat properties (#180)
Browse files Browse the repository at this point in the history
* Initialize arrMapString index before setting singleMapStat properties

* Rename arrMapString to mapStats
  • Loading branch information
vkeyboardv committed Apr 12, 2024
1 parent 1072b25 commit 7e5df69
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/components/PlayerStatTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,48 @@
<v-container class="mapinfo" fluid>
<div
class="text-subtitle-2 mapInfo"
v-if="arrMapString[index] != null"
v-if="mapStats[index] != null"
align="center"
>
{{ arrMapString[index].score }} - {{ arrMapString[index].map }}
{{ mapStats[index].score }} - {{ mapStats[index].map }}
</div>
<div
class="text-subtitle-2 mapInfo"
v-if="
arrMapString[index] != null && arrMapString[index].start != null
mapStats[index] != null && mapStats[index].start != null
"
align="center"
>
{{ arrMapString[index].start }}
{{ mapStats[index].start }}
</div>
<div
class="text-subtitle-2 mapInfo"
v-if="
arrMapString[index] != null && arrMapString[index].end != null
mapStats[index] != null && mapStats[index].end != null
"
align="center"
>
{{ arrMapString[index].end }}
{{ mapStats[index].end }}
</div>
<div
class="text-subtitle-2 mapInfo"
v-if="
arrMapString[index] != null && arrMapString[index].demo != null
mapStats[index] != null && mapStats[index].demo != null
"
align="center"
>
<v-btn
small
color="secondary"
:href="apiUrl + '/demo/' + arrMapString[index].demo"
:href="apiUrl + '/demo/' + mapStats[index].demo"
>
{{ $t("PlayerStats.Download") }}
</v-btn>
</div>
<div
class="text-subtitle-2 mapInfo"
v-if="
arrMapString[index] != null && arrMapString[index].end == null
mapStats[index] != null && mapStats[index].end == null
"
align="left"
></div>
Expand Down Expand Up @@ -113,7 +113,7 @@ export default {
return {
playerstats: [],
isLoading: true,
arrMapString: [{}],
mapStats: [],
allowRefresh: false,
timeoutId: -1,
isFinished: false,
Expand Down Expand Up @@ -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(
Expand All @@ -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;
}
Expand Down

0 comments on commit 7e5df69

Please sign in to comment.