Fix army member click area & sort campaign all overview sorting

pull/12/head
Florian Hartwich 2017-10-07 13:05:10 +02:00
parent 51a203861b
commit 436f6585c2
4 changed files with 36 additions and 25 deletions

View File

@ -55,7 +55,6 @@ img {
.member-link {
cursor: pointer;
display: block;
text-decoration: underline;
}

View File

@ -11,11 +11,14 @@
</div>
<div class="row middle-row">
<div class="squad-cell name-cell">
<span class="member-link text-blufor"
*ngFor="let member of squad.members"
<span class="text-blufor"
style="display: block"
*ngFor="let member of squad.members">
<span class="member-link"
(click)="select(member._id)">
{{member.rank}} {{member.username}}
</span>
</span>
</div>
</div>
<div class="row colored-row footer-row">
@ -37,11 +40,14 @@
</div>
<div class="row middle-row">
<div class="squad-cell name-cell">
<span class="member-link text-opfor"
*ngFor="let member of squad.members"
<span class="text-opfor"
style="display: block"
*ngFor="let member of squad.members">
<span class="member-link"
(click)="select(member._id)">
{{member.rank}} {{member.username}}
</span>
</span>
</div>
</div>
<div class="row colored-row footer-row">

View File

@ -25,7 +25,8 @@
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisLabel"
[autoScale]="autoscale"
[timeline]="timeline">
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
</div>

View File

@ -38,7 +38,6 @@ export class StatisticOverviewComponent {
autoscale = true;
timeline = false;
constructor(private route: ActivatedRoute,
private campaignService: CampaignService) {
}
@ -63,14 +62,20 @@ export class StatisticOverviewComponent {
let itemsProcessed = 0;
campaigns = campaigns.filter(campaign => this.id === 'all' || campaign._id === this.id);
campaigns.forEach(campaign => {
if (this.id === 'all') {
this.title = "Gesamtübersicht";
} else {
this.title = campaign.title;
}
wars = wars.concat(campaign.wars);
itemsProcessed++;
if (itemsProcessed === campaigns.length) {
if (this.id === 'all') {
this.title = "Gesamtübersicht";
wars.sort((a, b) => {
// sort by dates, because older campaign can contain newer war
if (a['date'] > (b['date'])) return -1;
if (a['date'] < (b['date'])) return 1;
return 0;
})
} else {
this.title = campaign.title;
}
this.initChart(wars);
}
})