Fix Highscore link and overview after redirect from edit campaign
parent
1be757bbc1
commit
c9fce51ef6
|
@ -16,8 +16,6 @@ import {PlayerUtils} from '../../../utils/player-utils';
|
||||||
})
|
})
|
||||||
export class StatisticHighScoreComponent implements OnInit {
|
export class StatisticHighScoreComponent implements OnInit {
|
||||||
|
|
||||||
@Input() campaigns;
|
|
||||||
|
|
||||||
id = '';
|
id = '';
|
||||||
|
|
||||||
searchTerm = new FormControl();
|
searchTerm = new FormControl();
|
||||||
|
@ -31,8 +29,7 @@ export class StatisticHighScoreComponent implements OnInit {
|
||||||
readonly fraction = Fraction;
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private playerService: PlayerService,
|
private playerService: PlayerService) {
|
||||||
private campaignService: CampaignService) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -40,10 +37,8 @@ export class StatisticHighScoreComponent implements OnInit {
|
||||||
.map(params => params['id'])
|
.map(params => params['id'])
|
||||||
.subscribe((id) => {
|
.subscribe((id) => {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.campaignService.getAllCampaignsWithWars().subscribe(campaigns => {
|
|
||||||
this.initData();
|
this.initData();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const searchTermStream = this.searchTerm.valueChanges.debounceTime(400);
|
const searchTermStream = this.searchTerm.valueChanges.debounceTime(400);
|
||||||
|
|
||||||
|
|
|
@ -91,36 +91,40 @@ export class StatisticOverviewComponent implements OnInit {
|
||||||
const playersObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
const playersObj = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
|
|
||||||
for (let i = wars.length - 1; i >= 0; i--) {
|
for (let i = wars.length - 1; i >= 0; i--) {
|
||||||
|
const war = wars[i];
|
||||||
|
if (!war) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const j = wars.length - i - 1;
|
const j = wars.length - i - 1;
|
||||||
const warDate = (this.id === 'all') ? new Date(wars[i].date) : ChartUtils.getShortDateString(wars[i].date);
|
const warDate = (this.id === 'all') ? new Date(war.date) : ChartUtils.getShortDateString(war.date);
|
||||||
|
|
||||||
pointsObj[0].series.push({
|
pointsObj[0].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: wars[i].ptBlufor
|
value: war.ptBlufor
|
||||||
});
|
});
|
||||||
pointsObj[1].series.push({
|
pointsObj[1].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: wars[i].ptOpfor
|
value: war.ptOpfor
|
||||||
});
|
});
|
||||||
pointsSumObj[0].series.push({
|
pointsSumObj[0].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: pointsSumObj[0].series[j - 1] ?
|
value: pointsSumObj[0].series[j - 1] ?
|
||||||
pointsSumObj[0].series[j - 1].value + wars[i].ptBlufor :
|
pointsSumObj[0].series[j - 1].value + war.ptBlufor :
|
||||||
wars[i].ptBlufor
|
war.ptBlufor
|
||||||
});
|
});
|
||||||
pointsSumObj[1].series.push({
|
pointsSumObj[1].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: pointsSumObj[1].series[j - 1]
|
value: pointsSumObj[1].series[j - 1]
|
||||||
? pointsSumObj[1].series[j - 1].value + wars[i].ptOpfor :
|
? pointsSumObj[1].series[j - 1].value + war.ptOpfor :
|
||||||
wars[i].ptOpfor
|
war.ptOpfor
|
||||||
});
|
});
|
||||||
playersObj[0].series.push({
|
playersObj[0].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: wars[i].playersBlufor
|
value: war.playersBlufor
|
||||||
});
|
});
|
||||||
playersObj[1].series.push({
|
playersObj[1].series.push({
|
||||||
name: warDate,
|
name: warDate,
|
||||||
value: wars[i].playersOpfor
|
value: war.playersOpfor
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue