From b73a67df9c9405abcefb20ae0d1bcd53c652e83e Mon Sep 17 00:00:00 2001 From: HardiReady Date: Sun, 17 Feb 2019 19:37:06 +0100 Subject: [PATCH] Fix transport stats value drop on navigation (CC-88) --- .../war/scoreboard/scoreboard.component.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/static/src/app/statistic/war/scoreboard/scoreboard.component.ts b/static/src/app/statistic/war/scoreboard/scoreboard.component.ts index 4cdc8e3..19b1e28 100644 --- a/static/src/app/statistic/war/scoreboard/scoreboard.component.ts +++ b/static/src/app/statistic/war/scoreboard/scoreboard.component.ts @@ -26,10 +26,6 @@ export class ScoreboardComponent implements OnChanges { isSteamUUID = PlayerUtils.isSteamUUID; - cellHeight = 40; - - columnWidth = 65; - rows = []; sortedRows = []; @@ -52,11 +48,16 @@ export class ScoreboardComponent implements OnChanges { ngOnChanges(changes: SimpleChanges) { if (changes.war) { - this.war.players.forEach(player => { - // meters to kilometer or fill with null, since optional - player.travelDistance = player.travelDistance ? Math.round(player.travelDistance / 1000) : 0; - player.driverDistance = player.driverDistance ? Math.round(player.driverDistance / 1000) : 0; - }); + + changes.war.currentValue.players + .filter(player => !player.initalized) + .forEach(player => { + // meters to kilometer or fill with null, since optional + player.travelDistance = player.travelDistance ? Math.round(player.travelDistance / 1000) : 0; + player.driverDistance = player.driverDistance ? Math.round(player.driverDistance / 1000) : 0; + // mark initialized to avoid processing again on navigation + player.initalized = true; + }); this.rows = changes.war.currentValue.players; this.currentSort.active = 'kill';