use var for repeatitive calculation

pull/32/head
Florian Hartwich 2018-03-28 15:07:08 +02:00
parent 81f6f0129c
commit 0a12f5470a
1 changed files with 3 additions and 2 deletions

View File

@ -96,12 +96,13 @@ export class CampaignPlayerDetailComponent implements OnInit {
this.reviveData = this.assignData(this.yAxisRevive, 'revive');
this.captureData = this.assignData(this.yAxisCapture, 'flagTouch');
this.kdRatio = parseFloat((this.totalKills / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
const totalDeathDiv = this.totalDeath === 0 ? 1 : this.totalDeath;
this.kdRatio = parseFloat((this.totalKills / totalDeathDiv).toFixed(2));
if (this.kdRatio > 1) {
this.maxKd = this.kdRatio * 1.7;
}
this.respawnDeathRatio = parseFloat((this.totalRespawn / (this.totalDeath === 0 ? 1 : this.totalDeath)).toFixed(2));
this.respawnDeathRatio = parseFloat((this.totalRespawn / totalDeathDiv).toFixed(2));
this.sumData = [
{