can now switch between tiers
This commit is contained in:
parent
bce762bf4e
commit
eb7ab4efd9
@ -1,4 +1,4 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
|
||||||
import {ChampionshipService} from '../../championship.service';
|
import {ChampionshipService} from '../../championship.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -6,7 +6,7 @@ import {ChampionshipService} from '../../championship.service';
|
|||||||
templateUrl: './poule.component.html',
|
templateUrl: './poule.component.html',
|
||||||
styleUrls: ['./poule.component.scss']
|
styleUrls: ['./poule.component.scss']
|
||||||
})
|
})
|
||||||
export class PouleComponent implements OnInit {
|
export class PouleComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
poule: number;
|
poule: number;
|
||||||
@ -26,6 +26,10 @@ export class PouleComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.loadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadData() {
|
||||||
console.log('POULE COMP: ' + this.poule + ' ' + this.idChampionship + ' ' + this.tier);
|
console.log('POULE COMP: ' + this.poule + ' ' + this.idChampionship + ' ' + this.tier);
|
||||||
// fetch the poule data
|
// fetch the poule data
|
||||||
this.championshipService.getTeamsInPoule(this.idChampionship, this.tier, this.poule).subscribe(val => {
|
this.championshipService.getTeamsInPoule(this.idChampionship, this.tier, this.poule).subscribe(val => {
|
||||||
@ -85,9 +89,9 @@ export class PouleComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const totalTimes: number[] = [];
|
const totalTimes: number[] = [];
|
||||||
for(let raceNr = 0; raceNr < this.maxRaces; raceNr++) {
|
for (let raceNr = 0; raceNr < this.maxRaces; raceNr++) {
|
||||||
const raceTime = this.getRaceTime(raceNr, idTeam);
|
const raceTime = this.getRaceTime(raceNr, idTeam);
|
||||||
if(raceTime) {
|
if (raceTime) {
|
||||||
totalTimes.push(raceTime);
|
totalTimes.push(raceTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,4 +135,10 @@ export class PouleComponent implements OnInit {
|
|||||||
return this.timesIndexed[idTeam][raceNr].laptimesms;
|
return this.timesIndexed[idTeam][raceNr].laptimesms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
console.log('onchanges called...');
|
||||||
|
console.log(changes);
|
||||||
|
this.loadData();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user