From 9e8f3f8c71fc8d9e0ed6e1a27c17e4bc5a38592b Mon Sep 17 00:00:00 2001 From: Joachim Date: Sat, 1 Sep 2018 21:37:40 +0200 Subject: [PATCH] reworked the poule tables... my god. --- src/app/content/poule/poule.component.html | 104 ++++++++++++++++----- src/app/content/poule/poule.component.scss | 41 ++++---- src/app/content/poule/poule.component.ts | 24 ++++- src/app/content/tier/tier.component.scss | 1 + 4 files changed, 119 insertions(+), 51 deletions(-) diff --git a/src/app/content/poule/poule.component.html b/src/app/content/poule/poule.component.html index c2d630a..7ab3971 100644 --- a/src/app/content/poule/poule.component.html +++ b/src/app/content/poule/poule.component.html @@ -1,25 +1,85 @@ -
-
- Poule {{poule}} -
- - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Poule {{poule}}
+
+ + +
race
+ +
lap {{lapindex+1}}
+
+
penalty
+
total
+
result
+ + + + + +
+ {{team.name}} +
+ + + + + +
+ {{getLapTime(team.idteam, raceindex, lapindex)/1000 | number:'1.2-2'}} +
-
- - - - - - - - -
TeamRace {{x+1}}Gem. beste 2
{{team.name}} -

{{time/1000| number:'1.2-2'}}s

-

{{getRaceTime(x, team.idteam)/1000 | number:'1.2-2'}}s

-
{{getAvgOfBestTwo(team.idteam)/1000 | number:'1.2-2'}}s
+ + +
+ Race {{raceindex+1}} +
+ + +
+ {{getPenaltySum(raceindex, team.idteam)/1000 | number:'1.2-2'}} +
+
+ {{getRaceTime(raceindex, team.idteam)/1000 | number:'1.2-2'}} +
+ + + + + +
+ {{getAvgOfBestTwo(team.idteam)/1000 | number:'1.2-2'}} +
+ + +
diff --git a/src/app/content/poule/poule.component.scss b/src/app/content/poule/poule.component.scss index 56c1758..a02cb14 100644 --- a/src/app/content/poule/poule.component.scss +++ b/src/app/content/poule/poule.component.scss @@ -1,28 +1,21 @@ -.time { - background-color: aquamarine; - margin: 2px; -} - -.penaltycell { - transform: rotate(-90deg); -} -.penaltycell:after { - content: " s"; - font-size: 80%; -} - -.racetimetotal { - border-top: 1px solid black; - margin: 2px; -} - -.poule-title { +.poule-header { text-align: center; - border-bottom: darkgray 1px solid; - padding-bottom: 10px; - padding-top: 10px; + border-bottom: 1px solid darkgray; + margin-bottom: 10px; + margin-top: 10px; } -.poule-card { - box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12); +.teamname { + margin-top: 15px; + margin-bottom: 5px; + font-size: 120%; +} + +.toplevelheader { + font-size: 80%; + font-style: italic; +} + +.timecell { + font-family: monospace; } diff --git a/src/app/content/poule/poule.component.ts b/src/app/content/poule/poule.component.ts index 935ec09..eb6910e 100644 --- a/src/app/content/poule/poule.component.ts +++ b/src/app/content/poule/poule.component.ts @@ -21,6 +21,7 @@ export class PouleComponent implements OnInit, OnChanges { protected times: any[] = []; protected maxRaces = 0; private timesIndexed: {}; + protected maxLaps = 0; constructor(private championshipService: ChampionshipService) { } @@ -48,24 +49,28 @@ export class PouleComponent implements OnInit, OnChanges { // preprocess this array -> map idteam on the laptime array so we can index it using 0..n-1 this.timesIndexed = {}; + this.maxLaps = 0; this.times.forEach(t => { if (!this.timesIndexed[t.idteam]) { this.timesIndexed[t.idteam] = []; } this.timesIndexed[t.idteam].push({laptimesms: t.laptimesms, penaltysum: t.penaltysum}); + if (t.laptimesms.length > this.maxLaps) { + this.maxLaps = t.laptimesms.length; + } }); }); } - getPenaltySum(lapNr: number, idTeam: number) { + getPenaltySum(raceNr: number, idTeam: number) { if (!this.timesIndexed || !this.timesIndexed[idTeam] - || !this.timesIndexed[idTeam][lapNr] - || !this.timesIndexed[idTeam][lapNr].penaltysum) { - return null; + || !this.timesIndexed[idTeam][raceNr] + || !this.timesIndexed[idTeam][raceNr].penaltysum) { + return 0; } - const penaltysum = this.timesIndexed[idTeam][lapNr].penaltysum; + const penaltysum = this.timesIndexed[idTeam][raceNr].penaltysum; if (!penaltysum) { return 0; } @@ -132,6 +137,15 @@ export class PouleComponent implements OnInit, OnChanges { return this.timesIndexed[idTeam][raceNr].laptimesms; } + getLapTime(idTeam: number, raceNr: number, lapNr: number) { + const lapTime = this.getLapTimes(raceNr, idTeam); + if (lapTime) { + return lapTime[lapNr]; + } else { + return null; + } + } + ngOnChanges(changes: SimpleChanges): void { this.loadData(); } diff --git a/src/app/content/tier/tier.component.scss b/src/app/content/tier/tier.component.scss index 6b4afd6..d4f0f18 100644 --- a/src/app/content/tier/tier.component.scss +++ b/src/app/content/tier/tier.component.scss @@ -2,6 +2,7 @@ app-poule { margin: 10px; grid-row: 1; min-width: 470px; + box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12); } #poulecontainer {