Merge branch 'release/v1.6.2' of hardi/opt-cc into master
commit
7f84b065fc
|
@ -176,8 +176,15 @@ wars.route('/:id')
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete players having this war ID as foreign key
|
// delete linked appearances
|
||||||
PlayerModel.find({warId: item._id}).remove().exec();
|
PlayerModel.find({warId: item._id}).remove().exec();
|
||||||
|
LogKillModel.find({war: item._id}).remove().exec();
|
||||||
|
LogRespawnModel.find({war: item._id}).remove().exec();
|
||||||
|
LogReviveModel.find({war: item._id}).remove().exec();
|
||||||
|
LogFlagModel.find({war: item._id}).remove().exec();
|
||||||
|
LogBudgetModel.find({war: item._id}).remove().exec();
|
||||||
|
LogTransportModel.find({war: item._id}).remove().exec();
|
||||||
|
LogPointsModel.find({war: item._id}).remove().exec();
|
||||||
|
|
||||||
// check if logfiles exist and delete from fs
|
// check if logfiles exist and delete from fs
|
||||||
const warDir = __dirname + '/../resource/logs/' + req.params.id;
|
const warDir = __dirname + '/../resource/logs/' + req.params.id;
|
||||||
|
|
|
@ -67,9 +67,10 @@ const parseWarLog = (lineArray, war) => {
|
||||||
stats.war['endBudgetOpfor'] = transformMoneyString(budg[14]);
|
stats.war['endBudgetOpfor'] = transformMoneyString(budg[14]);
|
||||||
stats.war.endDate = new Date(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T0' + budg[5]);
|
stats.war.endDate = new Date(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T0' + budg[5]);
|
||||||
} else if (line.includes('Startbudget')) {
|
} else if (line.includes('Startbudget')) {
|
||||||
stats.war.date = new Date(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T22:00:00');
|
|
||||||
stats.war['budgetBlufor'] = transformMoneyString(budg[11]);
|
stats.war['budgetBlufor'] = transformMoneyString(budg[11]);
|
||||||
stats.war['budgetOpfor'] = transformMoneyString(budg[14]);
|
stats.war['budgetOpfor'] = transformMoneyString(budg[14]);
|
||||||
|
// this date needs to be assigned in first place !important
|
||||||
|
stats.war.date = new Date(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T22:00:00');
|
||||||
} else {
|
} else {
|
||||||
stats.budget.push(getBudgetEntry(budg, war._id, war.date));
|
stats.budget.push(getBudgetEntry(budg, war._id, war.date));
|
||||||
}
|
}
|
||||||
|
@ -103,6 +104,7 @@ const parseWarLog = (lineArray, war) => {
|
||||||
if (line.includes('Endpunktestand')) {
|
if (line.includes('Endpunktestand')) {
|
||||||
stats.war['ptBlufor'] = parseInt(pt[11]);
|
stats.war['ptBlufor'] = parseInt(pt[11]);
|
||||||
stats.war['ptOpfor'] = parseInt(pt[14].slice(0, -1));
|
stats.war['ptOpfor'] = parseInt(pt[14].slice(0, -1));
|
||||||
|
// EXIT LOOP
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
stats.points.push(getPointsEntry(pt, line, war._id, war.date))
|
stats.points.push(getPointsEntry(pt, line, war._id, war.date))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "opt-cc",
|
"name": "opt-cc",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Florian Hartwich <hardi@noarch.de>",
|
"author": "Florian Hartwich <hardi@noarch.de>",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
|
@ -97,7 +97,6 @@ export class StatisticOverviewComponent {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.activeSlideIndex = index;
|
this.activeSlideIndex = index;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initChart(wars: any[]) {
|
initChart(wars: any[]) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {SharedModule} from "../shared.module";
|
||||||
import {statsRouterModule, statsRoutingComponents} from "./stats.routing";
|
import {statsRouterModule, statsRoutingComponents} from "./stats.routing";
|
||||||
import {WarService} from "../services/logs/war.service";
|
import {WarService} from "../services/logs/war.service";
|
||||||
import {NgxChartsModule} from "@swimlane/ngx-charts";
|
import {NgxChartsModule} from "@swimlane/ngx-charts";
|
||||||
import {AccordionModule, TabsModule} from "ngx-bootstrap";
|
import {AccordionModule, BsDropdownModule, ButtonsModule, TabsModule} from "ngx-bootstrap";
|
||||||
import {CampaignService} from "../services/logs/campaign.service";
|
import {CampaignService} from "../services/logs/campaign.service";
|
||||||
import {NgxDatatableModule} from "@swimlane/ngx-datatable";
|
import {NgxDatatableModule} from "@swimlane/ngx-datatable";
|
||||||
import {PlayerService} from "../services/logs/player.service";
|
import {PlayerService} from "../services/logs/player.service";
|
||||||
|
@ -13,7 +13,7 @@ import {LogsService} from "../services/logs/logs.service";
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: statsRoutingComponents,
|
declarations: statsRoutingComponents,
|
||||||
imports: [CommonModule, SharedModule, statsRouterModule, NgxChartsModule,
|
imports: [CommonModule, SharedModule, statsRouterModule, NgxChartsModule,
|
||||||
AccordionModule.forRoot(), TabsModule.forRoot(), NgxDatatableModule],
|
AccordionModule.forRoot(), BsDropdownModule.forRoot(), ButtonsModule.forRoot(), TabsModule.forRoot(), NgxDatatableModule],
|
||||||
providers: [WarService, CampaignService, PlayerService, LogsService]
|
providers: [WarService, CampaignService, PlayerService, LogsService]
|
||||||
})
|
})
|
||||||
export class StatsModule {
|
export class StatsModule {
|
||||||
|
|
|
@ -42,19 +42,10 @@
|
||||||
color: blue;
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart-container {
|
|
||||||
width: 90%;
|
|
||||||
margin: 2%;
|
|
||||||
min-width: 900px;
|
|
||||||
height: 400px;
|
|
||||||
padding: 15px;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ########### TABS ########### */
|
/* ########### TABS ########### */
|
||||||
|
|
||||||
:host /deep/ .nav-tabs {
|
:host /deep/ .nav-tabs {
|
||||||
padding-left: 35%!important;
|
padding-left: 35% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host /deep/ .nav-link {
|
:host /deep/ .nav-link {
|
||||||
|
@ -63,11 +54,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:host /deep/ .nav-link:hover {
|
:host /deep/ .nav-link:hover {
|
||||||
background: #286090;
|
background: #afafaf;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host /deep/ .nav-tabs>li.active>a{
|
:host /deep/ .nav-tabs > li.active > a {
|
||||||
background: #222222;
|
background: #222222;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
@ -107,3 +98,40 @@
|
||||||
background-color: #f7f7f7;
|
background-color: #f7f7f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ########### CHART-TAB ######## */
|
||||||
|
|
||||||
|
.btn-dark {
|
||||||
|
background: #4b4b4b;
|
||||||
|
color: #f5f5f5;
|
||||||
|
border-color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-dark:hover {
|
||||||
|
background: #afafaf;
|
||||||
|
color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-dark.active {
|
||||||
|
background: #222222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
width: 95%;
|
||||||
|
margin: 2%;
|
||||||
|
min-width: 900px;
|
||||||
|
height: 600px;
|
||||||
|
padding: 15px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-select-group {
|
||||||
|
width: 50%;
|
||||||
|
margin: auto;
|
||||||
|
position: inherit;
|
||||||
|
display: block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.dropdown-menu > li > a {*/
|
||||||
|
/*cursor: pointer;*/
|
||||||
|
/*}*/
|
||||||
|
|
|
@ -25,9 +25,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pull-left " style="padding-left: 150px; padding-top:15px">
|
<div class="pull-left " style="padding-left: 150px; padding-top:15px">
|
||||||
<a class="btn btn-default" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log">Logfile
|
<a class="btn btn-default" style="margin: 20px" target="_blank" onclick="window.open(this.href, 'logfileWindow',
|
||||||
anzeigen</a>
|
'left=20,top=20,width=1380,height=600,toolbar=1,resizable=0'); return false;"
|
||||||
<form class="form-group">
|
href="resource/logs/{{war._id}}/clean.log">
|
||||||
|
Logfile anzeigen</a>
|
||||||
|
<form *ngIf="staticTabs.tabs[0].active" class="form-group">
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<input type="radio" name="fractSelect"
|
<input type="radio" name="fractSelect"
|
||||||
[checked]="(fractionRadioSelect == undefined) ? 'true' : 'false'"
|
[checked]="(fractionRadioSelect == undefined) ? 'true' : 'false'"
|
||||||
|
@ -94,10 +96,43 @@
|
||||||
<ng-template tabHeading>
|
<ng-template tabHeading>
|
||||||
<img src="../../../assets/fraction-btn.png"> Fraktionen
|
<img src="../../../assets/fraction-btn.png"> Fraktionen
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<div class="fade-in chart-container">
|
|
||||||
|
<!--<div class="btn-group" style="position: absolute; margin-left: 5%;" dropdown>-->
|
||||||
|
<!--<button dropdownToggle type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split">-->
|
||||||
|
<!--{{dataMode}} <span class="caret"></span>-->
|
||||||
|
<!--</button>-->
|
||||||
|
<!--<ul *dropdownMenu class="dropdown-menu" role="menu">-->
|
||||||
|
<!--<li role="menuitem"><a class="dropdown-item" (click)="toggleDataMode(0, 'Summe')">Summe</a></li>-->
|
||||||
|
<!--<li class="divider dropdown-divider"></li>-->
|
||||||
|
<!--<li class="disabled" role="menuitem">-->
|
||||||
|
<!--<a class="dropdown-item" style="cursor: default!important;">Interval:</a>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--<li role="menuitem"><a class="dropdown-item" (click)="toggleDataMode(1, '1 Minute')">1 Minute</a></li>-->
|
||||||
|
<!--<li role="menuitem"><a class="dropdown-item" (click)="toggleDataMode(5, '5 Minuten')">5 Minuten</a></li>-->
|
||||||
|
<!--<li role="menuitem"><a class="dropdown-item" (click)="toggleDataMode(10, '10 Minuten')">10 Minuten</a>-->
|
||||||
|
<!--<li role="menuitem"><a class="dropdown-item" (click)="toggleDataMode(20, '20 Minuten')">20 Minuten</a>-->
|
||||||
|
<!--<li role="menuitem"><a class="dropdown-item" (click)="toggleDataMode(40, '40 Minuten')">40 Minuten</a>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--</div>-->
|
||||||
|
|
||||||
|
<div class="chart-select-group btn-group" (click)="selectChart()">
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelPoints}}">{{labelPoints}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelBudget}}">{{labelBudget}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelKill}}">{{labelKill}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelFriendlyFire}}">{{labelFriendlyFire}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelRevive}}">{{labelRevive}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
||||||
|
btnRadio="{{labelStabilize}}">{{labelStabilize}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
||||||
|
btnRadio="{{labelTransport}}">{{labelTransport}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelFlag}}">{{labelFlag}}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="showLineChart" class="chart-container">
|
||||||
<ngx-charts-line-chart
|
<ngx-charts-line-chart
|
||||||
[scheme]="colorScheme"
|
[scheme]="colorScheme"
|
||||||
[results]="pointData"
|
[results]="lineChartData"
|
||||||
[gradient]="gradient"
|
[gradient]="gradient"
|
||||||
[xAxis]="xAxis"
|
[xAxis]="xAxis"
|
||||||
[yAxis]="yAxis"
|
[yAxis]="yAxis"
|
||||||
|
@ -105,118 +140,17 @@
|
||||||
[legendTitle]="legendTitle"
|
[legendTitle]="legendTitle"
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
[showXAxisLabel]="showXAxisLabel"
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
[showYAxisLabel]="showYAxisLabel"
|
||||||
[yAxisLabel]="yAxisLabelPoints"
|
[yAxisLabel]="lineChartLabel"
|
||||||
[autoScale]="autoscale"
|
[autoScale]="autoscale"
|
||||||
[timeline]="timeline"
|
[timeline]="timeline"
|
||||||
[roundDomains]="roundDomains">
|
[roundDomains]="roundDomains">
|
||||||
</ngx-charts-line-chart>
|
</ngx-charts-line-chart>
|
||||||
</div>
|
</div>
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-line-chart
|
<div *ngIf="!showLineChart" class="chart-container">
|
||||||
[scheme]="colorScheme"
|
|
||||||
[results]="budgetData"
|
|
||||||
[gradient]="gradient"
|
|
||||||
[xAxis]="xAxis"
|
|
||||||
[yAxis]="yAxis"
|
|
||||||
[legend]="legend"
|
|
||||||
[legendTitle]="legendTitle"
|
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
|
||||||
[yAxisLabel]="yAxisLabelBudget"
|
|
||||||
[autoScale]="autoscale"
|
|
||||||
[timeline]="timeline"
|
|
||||||
[roundDomains]="roundDomains">
|
|
||||||
</ngx-charts-line-chart>
|
|
||||||
</div>
|
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-line-chart
|
|
||||||
[scheme]="colorScheme"
|
|
||||||
[results]="killData"
|
|
||||||
[gradient]="gradient"
|
|
||||||
[xAxis]="xAxis"
|
|
||||||
[yAxis]="yAxis"
|
|
||||||
[legend]="legend"
|
|
||||||
[legendTitle]="legendTitle"
|
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
|
||||||
[yAxisLabel]="yAxisLabelKill"
|
|
||||||
[autoScale]="autoscale"
|
|
||||||
[timeline]="timeline"
|
|
||||||
[roundDomains]="roundDomains">
|
|
||||||
</ngx-charts-line-chart>
|
|
||||||
</div>
|
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-line-chart
|
|
||||||
[scheme]="colorScheme"
|
|
||||||
[results]="friendlyFireData"
|
|
||||||
[gradient]="gradient"
|
|
||||||
[xAxis]="xAxis"
|
|
||||||
[yAxis]="yAxis"
|
|
||||||
[legend]="legend"
|
|
||||||
[legendTitle]="legendTitle"
|
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
|
||||||
[yAxisLabel]="yAxisLabelFriendlyFire"
|
|
||||||
[autoScale]="autoscale"
|
|
||||||
[timeline]="timeline"
|
|
||||||
[roundDomains]="roundDomains">
|
|
||||||
</ngx-charts-line-chart>
|
|
||||||
</div>
|
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-line-chart
|
|
||||||
[scheme]="colorScheme"
|
|
||||||
[results]="transportData"
|
|
||||||
[gradient]="gradient"
|
|
||||||
[xAxis]="xAxis"
|
|
||||||
[yAxis]="yAxis"
|
|
||||||
[legend]="legend"
|
|
||||||
[legendTitle]="legendTitle"
|
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
|
||||||
[yAxisLabel]="yAxisLabelTransport"
|
|
||||||
[autoScale]="autoscale"
|
|
||||||
[timeline]="timeline"
|
|
||||||
[roundDomains]="roundDomains">
|
|
||||||
</ngx-charts-line-chart>
|
|
||||||
</div>
|
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-line-chart
|
|
||||||
[scheme]="colorScheme"
|
|
||||||
[results]="reviveData"
|
|
||||||
[gradient]="gradient"
|
|
||||||
[xAxis]="xAxis"
|
|
||||||
[yAxis]="yAxis"
|
|
||||||
[legend]="legend"
|
|
||||||
[legendTitle]="legendTitle"
|
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
|
||||||
[yAxisLabel]="yAxisLabelRevive"
|
|
||||||
[autoScale]="autoscale"
|
|
||||||
[timeline]="timeline"
|
|
||||||
[roundDomains]="roundDomains">
|
|
||||||
</ngx-charts-line-chart>
|
|
||||||
</div>
|
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-line-chart
|
|
||||||
[scheme]="colorScheme"
|
|
||||||
[results]="stabilizedData"
|
|
||||||
[gradient]="gradient"
|
|
||||||
[xAxis]="xAxis"
|
|
||||||
[yAxis]="yAxis"
|
|
||||||
[legend]="legend"
|
|
||||||
[legendTitle]="legendTitle"
|
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
|
||||||
[yAxisLabel]="yAxisLabelStabilize"
|
|
||||||
[autoScale]="autoscale"
|
|
||||||
[timeline]="timeline"
|
|
||||||
[roundDomains]="roundDomains">
|
|
||||||
</ngx-charts-line-chart>
|
|
||||||
</div>
|
|
||||||
<div class="fade-in chart-container">
|
|
||||||
<ngx-charts-area-chart
|
<ngx-charts-area-chart
|
||||||
[scheme]="colorScheme"
|
[scheme]="colorScheme"
|
||||||
[results]="flagData"
|
[results]="areaChartData"
|
||||||
[xAxis]="xAxis"
|
[xAxis]="xAxis"
|
||||||
[yAxis]="yAxis"
|
[yAxis]="yAxis"
|
||||||
[curve]="stepCurve"
|
[curve]="stepCurve"
|
||||||
|
@ -224,7 +158,7 @@
|
||||||
[legendTitle]="legendTitle"
|
[legendTitle]="legendTitle"
|
||||||
[showXAxisLabel]="showXAxisLabel"
|
[showXAxisLabel]="showXAxisLabel"
|
||||||
[showYAxisLabel]="showYAxisLabel"
|
[showYAxisLabel]="showYAxisLabel"
|
||||||
[yAxisLabel]="yAxisLabelFlag"
|
[yAxisLabel]="labelFlag"
|
||||||
[autoScale]="autoscale"
|
[autoScale]="autoscale"
|
||||||
[timeline]="timeline"
|
[timeline]="timeline"
|
||||||
[roundDomains]="false">
|
[roundDomains]="false">
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
///<reference path="../../utils/chart-utils.ts"/>
|
||||||
import {Component, ElementRef, ViewChild} from "@angular/core";
|
import {Component, ElementRef, ViewChild} from "@angular/core";
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {WarService} from "../../services/logs/war.service";
|
import {WarService} from "../../services/logs/war.service";
|
||||||
|
@ -5,6 +6,7 @@ import {War} from "../../models/model-interfaces";
|
||||||
import {LogsService} from "../../services/logs/logs.service";
|
import {LogsService} from "../../services/logs/logs.service";
|
||||||
import {TabsetComponent} from "ngx-bootstrap";
|
import {TabsetComponent} from "ngx-bootstrap";
|
||||||
import * as d3 from "d3";
|
import * as d3 from "d3";
|
||||||
|
import {ChartUtils} from "../../utils/chart-utils";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -20,6 +22,8 @@ export class WarDetailComponent {
|
||||||
|
|
||||||
war: War = {players: []};
|
war: War = {players: []};
|
||||||
|
|
||||||
|
public chartSelectModel: string;
|
||||||
|
|
||||||
fractionRadioSelect: string;
|
fractionRadioSelect: string;
|
||||||
|
|
||||||
playerChart: any[] = [];
|
playerChart: any[] = [];
|
||||||
|
@ -35,14 +39,8 @@ export class WarDetailComponent {
|
||||||
sortDescending: 'glyphicon glyphicon-triangle-bottom',
|
sortDescending: 'glyphicon glyphicon-triangle-bottom',
|
||||||
};
|
};
|
||||||
|
|
||||||
pointData: any[] = [];
|
lineChartData: any[] = [];
|
||||||
budgetData: any[] = [];
|
areaChartData: any[] = [];
|
||||||
killData: any[] = [];
|
|
||||||
friendlyFireData: any[] = [];
|
|
||||||
transportData: any[] = [];
|
|
||||||
reviveData: any[] = [];
|
|
||||||
stabilizedData: any[] = [];
|
|
||||||
flagData: any[] = [];
|
|
||||||
|
|
||||||
tmpPointData;
|
tmpPointData;
|
||||||
tmpBudgetData;
|
tmpBudgetData;
|
||||||
|
@ -53,19 +51,23 @@ export class WarDetailComponent {
|
||||||
tmpStabilizeData;
|
tmpStabilizeData;
|
||||||
tmpFlagCaptureData;
|
tmpFlagCaptureData;
|
||||||
|
|
||||||
|
initialized;
|
||||||
|
|
||||||
colorScheme = {
|
colorScheme = {
|
||||||
domain: ['#0000FF', '#B22222']
|
domain: ['#0000FF', '#B22222']
|
||||||
};
|
};
|
||||||
|
|
||||||
yAxisLabelPoints = 'Punkte';
|
labelPoints = 'Punkte';
|
||||||
yAxisLabelBudget = 'Budget';
|
labelBudget = 'Budget';
|
||||||
yAxisLabelKill = 'Kills';
|
labelKill = 'Kills';
|
||||||
yAxisLabelFriendlyFire = 'FriendlyFire';
|
labelFriendlyFire = 'FriendlyFire';
|
||||||
yAxisLabelTransport = 'Lufttransport';
|
labelTransport = 'Lufttransport';
|
||||||
yAxisLabelRevive = 'Revive';
|
labelRevive = 'Revive';
|
||||||
yAxisLabelStabilize = 'Stabilisiert';
|
labelStabilize = 'Stabilisiert';
|
||||||
yAxisLabelFlag = 'Flaggenbesitz';
|
labelFlag = 'Flaggenbesitz';
|
||||||
|
lineChartLabel: string = this.labelPoints;
|
||||||
|
|
||||||
|
showLineChart = true;
|
||||||
stepCurve = d3.curveStepAfter;
|
stepCurve = d3.curveStepAfter;
|
||||||
gradient = false;
|
gradient = false;
|
||||||
yAxis = true;
|
yAxis = true;
|
||||||
|
@ -77,7 +79,12 @@ export class WarDetailComponent {
|
||||||
autoscale = true;
|
autoscale = true;
|
||||||
timeline = false;
|
timeline = false;
|
||||||
roundDomains = true;
|
roundDomains = true;
|
||||||
fractionChartsInitialized: boolean = false;
|
|
||||||
|
startDateObj;
|
||||||
|
|
||||||
|
dataMode: string = 'Summe';
|
||||||
|
dataInterval: number = 0;
|
||||||
|
logData;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
@ -93,38 +100,24 @@ export class WarDetailComponent {
|
||||||
.subscribe(war => {
|
.subscribe(war => {
|
||||||
this.war = war;
|
this.war = war;
|
||||||
this.rows = war.players;
|
this.rows = war.players;
|
||||||
this.playerChart = [
|
this.playerChart = ChartUtils.getSingleDataArray('CSAT', war.playersOpfor, 'NATO', war.playersBlufor);
|
||||||
{
|
|
||||||
"name": "CSAT",
|
|
||||||
"value": war.playersOpfor
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "NATO",
|
|
||||||
"value": war.playersBlufor
|
|
||||||
}
|
|
||||||
];
|
|
||||||
this.tmpPointData = [
|
|
||||||
{
|
|
||||||
"name": "NATO",
|
|
||||||
"series": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "CSAT",
|
|
||||||
"series": []
|
|
||||||
}
|
|
||||||
];
|
|
||||||
this.tmpBudgetData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
this.tmpKillData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
this.tmpFrienlyFireData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
this.tmpTransportData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
this.tmpReviveData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
this.tmpStabilizeData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
this.tmpFlagCaptureData = JSON.parse(JSON.stringify(this.tmpPointData));
|
|
||||||
|
|
||||||
Object.assign(this, [this.playerChart, this.pointData, this.budgetData, this.killData,
|
this.initialized = {
|
||||||
this.friendlyFireData, this.transportData, this.reviveData, this.stabilizedData, this.flagData]);
|
basic: false,
|
||||||
|
budget: false,
|
||||||
|
kill: false,
|
||||||
|
revive: false,
|
||||||
|
transport: false,
|
||||||
|
flag: false
|
||||||
|
};
|
||||||
|
Object.assign(this, [this.playerChart, this.lineChartData, this.areaChartData]);
|
||||||
|
this.chartSelectModel = this.labelPoints;
|
||||||
|
|
||||||
this.fractionChartsInitialized = false;
|
this.startDateObj = new Date(this.war.date);
|
||||||
|
this.startDateObj.setHours(0);
|
||||||
|
this.startDateObj.setMinutes(1);
|
||||||
|
|
||||||
|
this.fractionRadioSelect = undefined;
|
||||||
this.staticTabs.tabs[0].active = true;
|
this.staticTabs.tabs[0].active = true;
|
||||||
this.scrollOverviewTop();
|
this.scrollOverviewTop();
|
||||||
});
|
});
|
||||||
|
@ -140,6 +133,46 @@ export class WarDetailComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectChart() {
|
||||||
|
if (this.chartSelectModel !== this.labelFlag) {
|
||||||
|
this.showLineChart = true;
|
||||||
|
this.lineChartLabel = this.chartSelectModel;
|
||||||
|
switch (this.chartSelectModel) {
|
||||||
|
case this.labelPoints:
|
||||||
|
this.lineChartData = this.tmpPointData;
|
||||||
|
break;
|
||||||
|
case this.labelBudget:
|
||||||
|
this.initBudgetData();
|
||||||
|
this.lineChartData = this.tmpBudgetData;
|
||||||
|
break;
|
||||||
|
case this.labelKill:
|
||||||
|
this.initKillData();
|
||||||
|
this.lineChartData = this.tmpKillData;
|
||||||
|
break;
|
||||||
|
case this.labelFriendlyFire:
|
||||||
|
this.initKillData();
|
||||||
|
this.lineChartData = this.tmpFrienlyFireData;
|
||||||
|
break;
|
||||||
|
case this.labelRevive:
|
||||||
|
this.initRevive();
|
||||||
|
this.lineChartData = this.tmpReviveData;
|
||||||
|
break;
|
||||||
|
case this.labelStabilize:
|
||||||
|
this.initRevive();
|
||||||
|
this.lineChartData = this.tmpStabilizeData;
|
||||||
|
break;
|
||||||
|
case this.labelTransport:
|
||||||
|
this.initTransportData();
|
||||||
|
this.lineChartData = this.tmpTransportData;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.initFlagHoldData();
|
||||||
|
this.showLineChart = false;
|
||||||
|
this.areaChartData = this.tmpFlagCaptureData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selectPlayerDetail(player) {
|
selectPlayerDetail(player) {
|
||||||
if (player && player.selected && player.selected.length > 0) {
|
if (player && player.selected && player.selected.length > 0) {
|
||||||
this.router.navigate(['../../campaign-player/' + this.war.campaign + '/' + player.selected[0].name],
|
this.router.navigate(['../../campaign-player/' + this.war.campaign + '/' + player.selected[0].name],
|
||||||
|
@ -154,222 +187,225 @@ export class WarDetailComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleDataMode(interval, entryString) {
|
||||||
|
this.dataInterval = interval;
|
||||||
|
this.dataMode = entryString;
|
||||||
|
this.initTransportData();
|
||||||
|
this.lineChartData = this.tmpTransportData;
|
||||||
|
}
|
||||||
|
|
||||||
loadFractionData() {
|
loadFractionData() {
|
||||||
if (!this.fractionChartsInitialized) {
|
if (this.initialized.basic) {
|
||||||
const startDateObj = new Date(this.war.date);
|
return;
|
||||||
startDateObj.setHours(0);
|
}
|
||||||
startDateObj.setMinutes(1);
|
|
||||||
|
|
||||||
this.logsService.getFullLog(this.war._id).subscribe((data) => {
|
this.initializeTempCollections();
|
||||||
// POINTS
|
|
||||||
data.points.forEach(pointEntry => {
|
|
||||||
const dateObj = new Date(this.war.date);
|
|
||||||
const time = pointEntry.time.split(':');
|
|
||||||
dateObj.setHours(time[0]);
|
|
||||||
dateObj.setMinutes(time[1]);
|
|
||||||
this.tmpPointData[0].series.push({
|
|
||||||
"name": new Date(pointEntry.time),
|
|
||||||
"value": pointEntry.ptBlufor
|
|
||||||
});
|
|
||||||
this.tmpPointData[1].series.push({
|
|
||||||
"name": new Date(pointEntry.time),
|
|
||||||
"value": pointEntry.ptOpfor
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// BUDGET
|
this.logsService.getFullLog(this.war._id).subscribe((data) => {
|
||||||
this.tmpBudgetData[0].series.push({
|
this.logData = data;
|
||||||
"name": startDateObj,
|
this.initPointData();
|
||||||
"value": this.war.budgetBlufor
|
this.showLineChart = true;
|
||||||
});
|
this.lineChartLabel = this.labelPoints;
|
||||||
this.tmpBudgetData[1].series.push({
|
this.lineChartData = this.tmpPointData;
|
||||||
"name": startDateObj,
|
this.initialized.basic = true;
|
||||||
"value": this.war.budgetOpfor
|
});
|
||||||
});
|
}
|
||||||
// This adds an entry for both fractions on every event
|
|
||||||
for (let i = 0; i < data.budget.length; i++) {
|
|
||||||
const budgetEntry = data.budget[i];
|
|
||||||
const fractionChange = budgetEntry.fraction === 'BLUFOR' ? 0 : 1;
|
|
||||||
const fractionOld = budgetEntry.fraction !== 'BLUFOR' ? 0 : 1;
|
|
||||||
|
|
||||||
this.tmpBudgetData[fractionChange].series.push({
|
initPointData() {
|
||||||
"name": new Date(budgetEntry.time),
|
this.logData.points.forEach(pointEntry => {
|
||||||
"value": budgetEntry.newBudget
|
this.tmpPointData[0].series.push(ChartUtils.getSeriesEntry(new Date(pointEntry.time), pointEntry.ptBlufor));
|
||||||
});
|
this.tmpPointData[1].series.push(ChartUtils.getSeriesEntry(new Date(pointEntry.time), pointEntry.ptOpfor));
|
||||||
|
});
|
||||||
|
this.addFinalTimeData(this.tmpPointData);
|
||||||
|
}
|
||||||
|
|
||||||
this.tmpBudgetData[fractionOld].series.push({
|
initBudgetData() {
|
||||||
"name": new Date(budgetEntry.time),
|
if (this.initialized.budget) {
|
||||||
"value": this.tmpBudgetData[fractionOld].series[this.tmpBudgetData[fractionOld].series.length-1].value
|
return;
|
||||||
});
|
}
|
||||||
|
this.logData.budget.forEach(budgetEntry => {
|
||||||
|
const budgetEntryDate = new Date(budgetEntry.time);
|
||||||
|
const fractionChange = budgetEntry.fraction === 'BLUFOR' ? 0 : 1;
|
||||||
|
const fractionOld = budgetEntry.fraction !== 'BLUFOR' ? 0 : 1;
|
||||||
|
|
||||||
|
if (WarDetailComponent.isTwoMinutesAhead(budgetEntryDate, this.tmpBudgetData)) {
|
||||||
|
this.tmpBudgetData[fractionChange].series.push(ChartUtils.getSeriesEntry(new Date(budgetEntry.time), budgetEntry.newBudget));
|
||||||
|
this.tmpBudgetData[fractionOld].series.push(ChartUtils.getSeriesEntry(new Date(budgetEntry.time),
|
||||||
|
this.tmpBudgetData[fractionOld].series[this.tmpBudgetData[fractionOld].series.length - 1].value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.addFinalTimeData(this.tmpBudgetData);
|
||||||
|
this.initialized.budget = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
initKillData() {
|
||||||
|
if (!this.initialized.kill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let killCountBlufor = 0, killCountOpfor = 0, ffKillCountBlufor = 0, ffKillCountOpfor = 0;
|
||||||
|
|
||||||
|
for (const {killEntry, index} of this.logData.kill.map((killEntry, index) => ({killEntry, index}))) {
|
||||||
|
const killEntryDate = new Date(killEntry.time);
|
||||||
|
if (killEntry.friendlyFire === false) {
|
||||||
|
if (killEntry.fraction === 'BLUFOR') {
|
||||||
|
killCountBlufor++;
|
||||||
}
|
}
|
||||||
|
if (killEntry.fraction === 'OPFOR') {
|
||||||
|
killCountOpfor++;
|
||||||
|
}
|
||||||
|
if (WarDetailComponent.isTwoMinutesAhead(killEntryDate, this.tmpKillData)) {
|
||||||
|
this.tmpKillData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountBlufor));
|
||||||
|
this.tmpKillData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountOpfor));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (killEntry.fraction === 'BLUFOR') {
|
||||||
|
ffKillCountBlufor++;
|
||||||
|
}
|
||||||
|
if (killEntry.fraction === 'OPFOR') {
|
||||||
|
ffKillCountOpfor++;
|
||||||
|
}
|
||||||
|
if (WarDetailComponent.isTwoMinutesAhead(killEntryDate, this.tmpFrienlyFireData)) {
|
||||||
|
this.tmpFrienlyFireData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountBlufor));
|
||||||
|
this.tmpFrienlyFireData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountOpfor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index === this.logData.kill.length - 1) {
|
||||||
|
this.tmpKillData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountBlufor));
|
||||||
|
this.tmpKillData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, killCountOpfor));
|
||||||
|
this.tmpFrienlyFireData[0].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountBlufor));
|
||||||
|
this.tmpFrienlyFireData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountOpfor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// KILLS
|
this.addFinalTimeData(this.tmpKillData);
|
||||||
let killCountBlufor = 0;
|
this.addFinalTimeData(this.tmpFrienlyFireData)
|
||||||
let killCountOpfor = 0;
|
this.initialized.kill = true;
|
||||||
let ffKillCountBlufor = 0;
|
}
|
||||||
let ffKillCountOpfor = 0;
|
|
||||||
this.tmpKillData[0].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": killCountBlufor
|
|
||||||
});
|
|
||||||
this.tmpKillData[1].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": killCountOpfor
|
|
||||||
});
|
|
||||||
this.tmpFrienlyFireData[0].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": ffKillCountBlufor
|
|
||||||
});
|
|
||||||
this.tmpFrienlyFireData[1].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": ffKillCountOpfor
|
|
||||||
});
|
|
||||||
|
|
||||||
data.kill.forEach(killEntry => {
|
initRevive() {
|
||||||
if (killEntry.fraction === 'BLUFOR') {
|
if (this.initialized.revive) {
|
||||||
if (killEntry.friendlyFire === false) {
|
return;
|
||||||
killCountBlufor++;
|
}
|
||||||
} else {
|
let reviveCountBlufor = 0, reviveCountOpfor = 0, stabilizeCountBlufor = 0, stabilizeCountOpfor = 0;
|
||||||
ffKillCountBlufor++;
|
for (const {reviveEntry, index} of this.logData.revive.map((reviveEntry, index) => ({reviveEntry, index}))) {
|
||||||
}
|
const reviveEntryDate = new Date(reviveEntry.time);
|
||||||
} else {
|
if (reviveEntry.stabilized === false) {
|
||||||
if (killEntry.friendlyFire === false) {
|
if (reviveEntry.fraction === 'BLUFOR') {
|
||||||
killCountOpfor++;
|
reviveCountBlufor++;
|
||||||
} else {
|
} else {
|
||||||
ffKillCountOpfor++;
|
reviveCountOpfor++;
|
||||||
}
|
}
|
||||||
}
|
if (WarDetailComponent.isTwoMinutesAhead(reviveEntryDate, this.tmpReviveData)) {
|
||||||
this.tmpKillData[killEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
|
this.tmpReviveData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountBlufor));
|
||||||
"name": new Date(killEntry.time),
|
this.tmpReviveData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountOpfor));
|
||||||
"value": killEntry.fraction === 'BLUFOR' ? killCountBlufor : killCountOpfor
|
}
|
||||||
});
|
} else {
|
||||||
this.tmpFrienlyFireData[killEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
|
if (reviveEntry.fraction === 'BLUFOR') {
|
||||||
"name": new Date(killEntry.time),
|
stabilizeCountBlufor++;
|
||||||
"value": killEntry.fraction === 'BLUFOR' ? ffKillCountBlufor : ffKillCountOpfor
|
} else {
|
||||||
});
|
stabilizeCountOpfor++;
|
||||||
});
|
}
|
||||||
|
if (WarDetailComponent.isTwoMinutesAhead(reviveEntryDate, this.tmpStabilizeData)) {
|
||||||
|
this.tmpStabilizeData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountBlufor));
|
||||||
|
this.tmpStabilizeData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountOpfor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index === this.logData.revive.length - 1) {
|
||||||
|
this.tmpReviveData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountBlufor));
|
||||||
|
this.tmpReviveData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, reviveCountOpfor));
|
||||||
|
this.tmpStabilizeData[0].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountBlufor));
|
||||||
|
this.tmpStabilizeData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountOpfor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addFinalTimeData(this.tmpReviveData);
|
||||||
|
this.addFinalTimeData(this.tmpStabilizeData);
|
||||||
|
this.initialized.revive = true;
|
||||||
|
}
|
||||||
|
|
||||||
// TRANSPORT
|
initTransportData() {
|
||||||
let transportCountBlufor = 0;
|
if (this.initialized.transport) {
|
||||||
let transportCountOpfor = 0;
|
return;
|
||||||
this.tmpTransportData[0].series.push({
|
}
|
||||||
"name": startDateObj,
|
let transportCountBlufor = 0, transportCountOpfor = 0;
|
||||||
"value": transportCountBlufor
|
for (const {transportEntry, index} of this.logData.transport.map((transportEntry, index) => ({
|
||||||
});
|
transportEntry,
|
||||||
this.tmpTransportData[1].series.push({
|
index
|
||||||
"name": startDateObj,
|
}))) {
|
||||||
"value": transportCountOpfor
|
const transportEntryDate = new Date(transportEntry.time);
|
||||||
});
|
if (transportEntry.fraction === 'BLUFOR') {
|
||||||
|
transportCountBlufor++;
|
||||||
|
} else {
|
||||||
|
transportCountOpfor++;
|
||||||
|
}
|
||||||
|
if (WarDetailComponent.isTwoMinutesAhead(transportEntryDate, this.tmpTransportData) || index === this.logData.transport.length - 1) {
|
||||||
|
this.tmpTransportData[0].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountBlufor));
|
||||||
|
this.tmpTransportData[1].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountOpfor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addFinalTimeData(this.tmpTransportData);
|
||||||
|
this.initialized.transport = true;
|
||||||
|
|
||||||
data.transport.forEach(transportEntry => {
|
}
|
||||||
if (transportEntry.fraction === 'BLUFOR') {
|
|
||||||
transportCountBlufor++;
|
|
||||||
} else {
|
|
||||||
transportCountOpfor++;
|
|
||||||
}
|
|
||||||
this.tmpTransportData[transportEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
|
|
||||||
"name": new Date(transportEntry.time),
|
|
||||||
"value": transportEntry.fraction === 'BLUFOR' ? transportCountBlufor : transportCountOpfor
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// REVIVE & STABILIZE
|
initFlagHoldData() {
|
||||||
let reviveCountBlufor = 0;
|
if (this.initialized.flag) {
|
||||||
let reviveCountOpfor = 0;
|
return;
|
||||||
let stabilizeCountBlufor = 0;
|
}
|
||||||
let stabilizeCountOpfor = 0;
|
let flagStatusBlufor = true;
|
||||||
this.tmpReviveData[0].series.push({
|
let flagStatusOpfor = true;
|
||||||
"name": startDateObj,
|
this.tmpFlagCaptureData[0].series.push(ChartUtils.getSeriesEntry(this.startDateObj, flagStatusBlufor));
|
||||||
"value": reviveCountBlufor
|
this.tmpFlagCaptureData[1].series.push(ChartUtils.getSeriesEntry(this.startDateObj, flagStatusOpfor));
|
||||||
});
|
|
||||||
this.tmpReviveData[1].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": reviveCountOpfor
|
|
||||||
});
|
|
||||||
this.tmpStabilizeData[0].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": stabilizeCountBlufor
|
|
||||||
});
|
|
||||||
this.tmpStabilizeData[1].series.push({
|
|
||||||
"name": startDateObj,
|
|
||||||
"value": stabilizeCountOpfor
|
|
||||||
});
|
|
||||||
data.revive.forEach(reviveEntry => {
|
|
||||||
if (reviveEntry.fraction === 'BLUFOR') {
|
|
||||||
if (reviveEntry.stabilized === false) {
|
|
||||||
reviveCountBlufor++;
|
|
||||||
} else {
|
|
||||||
stabilizeCountBlufor++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (reviveEntry.stabilized === false) {
|
|
||||||
reviveCountOpfor++;
|
|
||||||
} else {
|
|
||||||
stabilizeCountOpfor++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.tmpReviveData[reviveEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
|
|
||||||
"name": new Date(reviveEntry.time),
|
|
||||||
"value": reviveEntry.fraction === 'BLUFOR' ? reviveCountBlufor : reviveCountOpfor
|
|
||||||
});
|
|
||||||
this.tmpStabilizeData[reviveEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
|
|
||||||
"name": new Date(reviveEntry.time),
|
|
||||||
"value": reviveEntry.fraction === 'BLUFOR' ? stabilizeCountBlufor : stabilizeCountOpfor
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// FLAG
|
this.logData.flag.forEach(flagEntry => {
|
||||||
let flagStatusBlufor = true;
|
if (flagEntry.flagFraction === 'BLUFOR') {
|
||||||
let flagStatusOpfor = true;
|
flagStatusBlufor = !flagEntry.capture;
|
||||||
this.tmpFlagCaptureData[0].series.push({
|
} else {
|
||||||
"name": startDateObj,
|
flagStatusOpfor = !flagEntry.capture;
|
||||||
"value": flagStatusBlufor
|
}
|
||||||
});
|
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push(
|
||||||
this.tmpFlagCaptureData[1].series.push({
|
ChartUtils.getSeriesEntry(new Date(flagEntry.time), flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor)
|
||||||
"name": startDateObj,
|
)
|
||||||
"value": flagStatusOpfor
|
});
|
||||||
});
|
|
||||||
|
|
||||||
data.flag.forEach(flagEntry => {
|
this.addFinalTimeData(this.tmpFlagCaptureData);
|
||||||
if (flagEntry.flagFraction === 'BLUFOR') {
|
this.initialized.flag = true;
|
||||||
flagStatusBlufor = !flagEntry.capture
|
}
|
||||||
} else {
|
|
||||||
flagStatusOpfor = !flagEntry.capture;
|
|
||||||
}
|
|
||||||
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push({
|
|
||||||
"name": new Date(flagEntry.time),
|
|
||||||
"value": flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this.addFinalTimeDataEntriesAndPopulate(new Date(this.war.endDate));
|
private static isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
|
||||||
|
return entryDate.getTime() >= tmpData[0].series[tmpData[0].series.length - 1].name.getTime() + (1.5 * 60000)
|
||||||
|
}
|
||||||
|
|
||||||
this.fractionChartsInitialized = true;
|
initializeTempCollections() {
|
||||||
});
|
this.tmpPointData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpBudgetData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpKillData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpFrienlyFireData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpTransportData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpReviveData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpStabilizeData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray('NATO', 'CSAT');
|
||||||
|
|
||||||
|
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
|
||||||
|
[0, 1].forEach(index => {
|
||||||
|
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
|
||||||
|
})
|
||||||
|
});
|
||||||
|
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetBlufor));
|
||||||
|
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(this.startDateObj, this.war.budgetOpfor));
|
||||||
|
}
|
||||||
|
|
||||||
|
addFinalTimeData(tmpCollection) {
|
||||||
|
const endDate = new Date(this.war.endDate);
|
||||||
|
if (tmpCollection === this.tmpBudgetData) {
|
||||||
|
this.tmpBudgetData[0].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetBlufor));
|
||||||
|
this.tmpBudgetData[1].series.push(ChartUtils.getSeriesEntry(endDate, this.war.endBudgetOpfor));
|
||||||
|
} else {
|
||||||
|
for (let j in [0, 1]) {
|
||||||
|
if (tmpCollection[j].series[tmpCollection[j].series.length - 1].name < endDate) {
|
||||||
|
tmpCollection[j].series.push(ChartUtils.getSeriesEntry(endDate, tmpCollection[j].series[tmpCollection[j].series.length - 1].value));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addFinalTimeDataEntriesAndPopulate(endDate) {
|
|
||||||
[this.tmpPointData, this.tmpBudgetData, this.tmpTransportData, this.tmpReviveData, this.tmpStabilizeData,
|
|
||||||
this.tmpKillData, this.tmpFrienlyFireData, this.tmpFlagCaptureData].forEach(tmp => {
|
|
||||||
for (let j in [0, 1]) {
|
|
||||||
if (tmp[j].series[tmp[j].series.length - 1].name < endDate) {
|
|
||||||
tmp[j].series.push({
|
|
||||||
'name': endDate,
|
|
||||||
'value': tmp[j].series[tmp[j].series.length - 1].value
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.pointData = this.tmpPointData;
|
|
||||||
this.budgetData = this.tmpBudgetData;
|
|
||||||
this.transportData = this.tmpTransportData;
|
|
||||||
this.reviveData = this.tmpReviveData;
|
|
||||||
this.stabilizedData = this.tmpStabilizeData;
|
|
||||||
this.killData = this.tmpKillData;
|
|
||||||
this.friendlyFireData = this.tmpFrienlyFireData;
|
|
||||||
this.flagData = this.tmpFlagCaptureData;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,32 @@ export class ChartUtils {
|
||||||
return (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
|
return (dayDate < 10 ? "0" + dayDate : dayDate) + '.'
|
||||||
+ isoDate.slice(5, 7) + '.' + isoDate.slice(2, 4);
|
+ isoDate.slice(5, 7) + '.' + isoDate.slice(2, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static getSeriesEntry(name, value) {
|
||||||
|
return {
|
||||||
|
"name": name,
|
||||||
|
"value": value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getMultiDataArray(...args: string[]) : any[] {
|
||||||
|
const obj = [];
|
||||||
|
for (let i = 0, arg; arg = args[i]; i++) {
|
||||||
|
obj.push({
|
||||||
|
"name": arg,
|
||||||
|
"series": []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getSingleDataArray(name1, value1, name2, value2): any[] {
|
||||||
|
return [{
|
||||||
|
"name": name1,
|
||||||
|
"value": value1
|
||||||
|
}, {
|
||||||
|
"name": name2,
|
||||||
|
"value": value2
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue