Finish vehicle class parsing

pull/33/head
HardiReady 2018-04-15 13:37:51 +02:00
parent 5e8a2b4db2
commit 8b3151db53
8 changed files with 172 additions and 166 deletions

View File

@ -102,10 +102,12 @@ const parseWarLog = (lineArray, war) => {
// this date needs to be assigned in first place !important // this date needs to be assigned in first place !important
const dateString = budg[0].slice(0, -1).split('/').map((s) => parseInt(s)); const dateString = budg[0].slice(0, -1).split('/').map((s) => parseInt(s));
stats.war.date = new Date(dateString[0], dateString[1] - 1, dateString[2]); stats.war.date = new Date(dateString[0], dateString[1] - 1, dateString[2]);
console.log(war.date);
} else if (line.includes('Endbudget')) { } else if (line.includes('Endbudget')) {
stats.war['endBudgetBlufor'] = transformMoneyString(budg[9].substr(1)); stats.war['endBudgetBlufor'] = transformMoneyString(budg[9].substr(1));
stats.war['endBudgetOpfor'] = transformMoneyString(budg[12].slice(0, -1)); stats.war['endBudgetOpfor'] = transformMoneyString(budg[12].slice(0, -1));
stats.war.endDate = getFullTimeDate(war.date, budg[5]); stats.war.endDate = getFullTimeDate(war.date, budg[5]);
console.log(war.endDate);
} else { } else {
stats.budget.push(getBudgetEntry(budg, war._id, war.date)); stats.budget.push(getBudgetEntry(budg, war._id, war.date));
} }
@ -314,6 +316,10 @@ const transformMoneyString = (budgetString) => {
}; };
const getFullTimeDate = (date, timeString) => { const getFullTimeDate = (date, timeString) => {
console.log(date)
console.log(timeString)
const returnDate = new Date(date); const returnDate = new Date(date);
const time = timeString.split(':'); const time = timeString.split(':');
returnDate.setHours(time[0]); returnDate.setHours(time[0]);

View File

@ -86,7 +86,7 @@
</div> </div>
</nav> </nav>
<button (click)="scrollToTop()" *ngIf="scrollTopVisible" id="scrollTopBtn" title="Scroll to top"></button> <button (click)="scrollToTop()" *ngIf="scrollTopVisible" id="scrollTopBtn" title="Zum Seitenanfang"></button>
</div> </div>

View File

@ -81,66 +81,6 @@
</ngx-charts-line-chart> </ngx-charts-line-chart>
</div> </div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleLightData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleLight"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleHeavyData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleHeavy"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleAirData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleAir"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
<div class="chart-container"> <div class="chart-container">
<ngx-charts-line-chart <ngx-charts-line-chart
[results]="deathData" [results]="deathData"
@ -220,5 +160,65 @@
[roundDomains]="roundDomains"> [roundDomains]="roundDomains">
</ngx-charts-line-chart> </ngx-charts-line-chart>
</div> </div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleLightData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleLight"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleHeavyData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleHeavy"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
<div class="chart-container">
<ngx-charts-line-chart
[results]="vehicleAirData"
[showRefLines]="showRefLines"
[showRefLabels]="showRefLabels"
[referenceLines]="killRefLines"
[scheme]="colorScheme"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[legend]="legend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisVehicleAir"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
</div> </div>
</div> </div>

View File

@ -33,9 +33,9 @@ export class CampaignPlayerDetailComponent implements OnInit {
yAxisKill = 'Kills'; yAxisKill = 'Kills';
yAxisFriendlyFire = 'FriendlyFire'; yAxisFriendlyFire = 'FriendlyFire';
yAxisVehicleLight = 'Fahrzeug (Leicht)'; yAxisVehicleLight = 'Fahrzeug (Light)';
yAxisVehicleHeavy = 'Fahrzeug (Schwer)'; yAxisVehicleHeavy = 'Fahrzeug (Heavy)';
yAxisVehicleAir = 'Fahrzeug (Luft)'; yAxisVehicleAir = 'Fahrzeug (Air)';
yAxisDeath = 'Tode'; yAxisDeath = 'Tode';
yAxisRespawn = 'Respawn'; yAxisRespawn = 'Respawn';
yAxisRevive = 'Revive'; yAxisRevive = 'Revive';
@ -97,14 +97,14 @@ export class CampaignPlayerDetailComponent implements OnInit {
.subscribe(campaignPlayer => { .subscribe(campaignPlayer => {
this.campaignPlayer = campaignPlayer; this.campaignPlayer = campaignPlayer;
this.killData = this.assignData(this.yAxisKill, 'kill'); this.killData = this.assignData(this.yAxisKill, 'kill');
this.vehicleLightData = this.assignData(this.yAxisVehicleLight, 'vehicleLight');
this.vehicleHeavyData = this.assignData(this.yAxisVehicleHeavy, 'vehicleHeavy');
this.vehicleAirData = this.assignData(this.yAxisVehicleAir, 'vehicleAir');
this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, 'friendlyFire'); this.friendlyFireData = this.assignData(this.yAxisFriendlyFire, 'friendlyFire');
this.deathData = this.assignData(this.yAxisDeath, 'death'); this.deathData = this.assignData(this.yAxisDeath, 'death');
this.respawnData = this.assignData(this.yAxisRespawn, 'respawn'); this.respawnData = this.assignData(this.yAxisRespawn, 'respawn');
this.reviveData = this.assignData(this.yAxisRevive, 'revive'); this.reviveData = this.assignData(this.yAxisRevive, 'revive');
this.captureData = this.assignData(this.yAxisCapture, 'flagTouch'); this.captureData = this.assignData(this.yAxisCapture, 'flagTouch');
this.vehicleLightData = this.assignData(this.yAxisVehicleLight, 'vehicleLight');
this.vehicleHeavyData = this.assignData(this.yAxisVehicleHeavy, 'vehicleHeavy');
this.vehicleAirData = this.assignData(this.yAxisVehicleAir, 'vehicleAir');
const totalDeathDiv = this.totalDeath === 0 ? 1 : this.totalDeath; const totalDeathDiv = this.totalDeath === 0 ? 1 : this.totalDeath;
this.kdRatio = parseFloat((this.totalKills / totalDeathDiv).toFixed(2)); this.kdRatio = parseFloat((this.totalKills / totalDeathDiv).toFixed(2));
@ -123,18 +123,6 @@ export class CampaignPlayerDetailComponent implements OnInit {
name: this.yAxisFriendlyFire, name: this.yAxisFriendlyFire,
value: this.totalFriendlyFire value: this.totalFriendlyFire
}, },
{
name: this.yAxisVehicleLight,
value: this.totalVehicleLight
},
{
name: this.yAxisVehicleHeavy,
value: this.totalVehicleHeavy
},
{
name: this.yAxisVehicleAir,
value: this.totalVehicleAir
},
{ {
name: this.yAxisDeath, name: this.yAxisDeath,
value: this.totalDeath value: this.totalDeath
@ -150,7 +138,19 @@ export class CampaignPlayerDetailComponent implements OnInit {
{ {
name: this.yAxisCapture, name: this.yAxisCapture,
value: this.totalCapture value: this.totalCapture
} },
{
name: this.yAxisVehicleLight,
value: this.totalVehicleLight
},
{
name: this.yAxisVehicleHeavy,
value: this.totalVehicleHeavy
},
{
name: this.yAxisVehicleAir,
value: this.totalVehicleAir
},
]; ];
Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleLightData, Object.assign(this, [this.sumData, this.killData, this.friendlyFireData, this.vehicleLightData,
@ -184,18 +184,6 @@ export class CampaignPlayerDetailComponent implements OnInit {
this.friendlyFireRefLines.push({value: total / playerLength, name: this.avgLabel}); this.friendlyFireRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalFriendlyFire = total; this.totalFriendlyFire = total;
break; break;
case 'vehicleLight':
this.vehicleLightRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleLight = total;
break;
case 'vehicleHeavy':
this.vehicleHeavyRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleHeavy = total;
break;
case 'vehicleAir':
this.vehicleAirRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleAir = total;
break;
case 'death': case 'death':
this.deathRefLines.push({value: total / playerLength, name: this.avgLabel}); this.deathRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalDeath = total; this.totalDeath = total;
@ -212,6 +200,18 @@ export class CampaignPlayerDetailComponent implements OnInit {
this.captureRefLines.push({value: total / playerLength, name: this.avgLabel}); this.captureRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalCapture = total; this.totalCapture = total;
break; break;
case 'vehicleLight':
this.vehicleLightRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleLight = total;
break;
case 'vehicleHeavy':
this.vehicleHeavyRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleHeavy = total;
break;
case 'vehicleAir':
this.vehicleAirRefLines.push({value: total / playerLength, name: this.avgLabel});
this.totalVehicleAir = total;
break;
} }
return [killObj]; return [killObj];
} }

View File

@ -57,69 +57,6 @@
<ngx-datatable-column [width]="valueColWidth" name="FriendlyFire" prop="friendlyFire"></ngx-datatable-column> <ngx-datatable-column [width]="valueColWidth" name="FriendlyFire" prop="friendlyFire"></ngx-datatable-column>
</ngx-datatable> </ngx-datatable>
<ngx-datatable
[rows]="players.vehicleLight"
[messages]="emptyMessage"
[headerHeight]="cellHeight"
[rowHeight]="cellHeight"
[cssClasses]='customClasses'
[columnMode]="'force'"
[scrollbarV]="true"
[selectionType]="'single'">
<ngx-datatable-column [width]="numberColWidth" name="#" prop="num"></ngx-datatable-column>
<ngx-datatable-column name="Spieler" prop="name" [width]="nameColWidth" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fahrzeug (Leicht)" prop="vehicleLight"></ngx-datatable-column>
</ngx-datatable>
<ngx-datatable
[rows]="players.vehicleHeavy"
[messages]="emptyMessage"
[headerHeight]="cellHeight"
[rowHeight]="cellHeight"
[cssClasses]='customClasses'
[columnMode]="'force'"
[scrollbarV]="true"
[selectionType]="'single'">
<ngx-datatable-column [width]="numberColWidth" name="#" prop="num"></ngx-datatable-column>
<ngx-datatable-column name="Spieler" prop="name" [width]="nameColWidth" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fahrzeug (Schwer)" prop="vehicleHeavy"></ngx-datatable-column>
</ngx-datatable>
<ngx-datatable
[rows]="players.vehicleAir"
[messages]="emptyMessage"
[headerHeight]="cellHeight"
[rowHeight]="cellHeight"
[cssClasses]='customClasses'
[columnMode]="'force'"
[scrollbarV]="true"
[selectionType]="'single'">
<ngx-datatable-column [width]="numberColWidth" name="#" prop="num"></ngx-datatable-column>
<ngx-datatable-column name="Spieler" prop="name" [width]="nameColWidth" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fahrzeug (Luft)" prop="vehicleAir"></ngx-datatable-column>
</ngx-datatable>
<ngx-datatable <ngx-datatable
[rows]="players.death" [rows]="players.death"
[messages]="emptyMessage" [messages]="emptyMessage"
@ -204,5 +141,68 @@
<ngx-datatable-column [width]="valueColWidth" name="Eroberung" prop="flagTouch"></ngx-datatable-column> <ngx-datatable-column [width]="valueColWidth" name="Eroberung" prop="flagTouch"></ngx-datatable-column>
</ngx-datatable> </ngx-datatable>
<ngx-datatable
[rows]="players.vehicleLight"
[messages]="emptyMessage"
[headerHeight]="cellHeight"
[rowHeight]="cellHeight"
[cssClasses]='customClasses'
[columnMode]="'force'"
[scrollbarV]="true"
[selectionType]="'single'">
<ngx-datatable-column [width]="numberColWidth" name="#" prop="num"></ngx-datatable-column>
<ngx-datatable-column name="Spieler" prop="name" [width]="nameColWidth" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fzg (Light)" prop="vehicleLight"></ngx-datatable-column>
</ngx-datatable>
<ngx-datatable
[rows]="players.vehicleHeavy"
[messages]="emptyMessage"
[headerHeight]="cellHeight"
[rowHeight]="cellHeight"
[cssClasses]='customClasses'
[columnMode]="'force'"
[scrollbarV]="true"
[selectionType]="'single'">
<ngx-datatable-column [width]="numberColWidth" name="#" prop="num"></ngx-datatable-column>
<ngx-datatable-column name="Spieler" prop="name" [width]="nameColWidth" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fzg (Heavy)" prop="vehicleHeavy"></ngx-datatable-column>
</ngx-datatable>
<ngx-datatable
[rows]="players.vehicleAir"
[messages]="emptyMessage"
[headerHeight]="cellHeight"
[rowHeight]="cellHeight"
[cssClasses]='customClasses'
[columnMode]="'force'"
[scrollbarV]="true"
[selectionType]="'single'">
<ngx-datatable-column [width]="numberColWidth" name="#" prop="num"></ngx-datatable-column>
<ngx-datatable-column name="Spieler" prop="name" [width]="nameColWidth" style="padding-left:10px">
<ng-template ngx-datatable-cell-template let-row="row" let-value="value">
<span class="player-name"
[style.color]="row['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{value}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fzg (Air)" prop="vehicleAir"></ngx-datatable-column>
</ngx-datatable>
</div> </div>

View File

@ -5,7 +5,7 @@
/* ########### DATATABLE ########### */ /* ########### DATATABLE ########### */
ngx-datatable { ngx-datatable {
width: 1030px; width: 1040px;
margin: auto; margin: auto;
height: 68vh; height: 68vh;
} }

View File

@ -23,15 +23,15 @@
{{value === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}} {{value === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}}
</ng-template> </ng-template>
</ngx-datatable-column> </ngx-datatable-column>
<ngx-datatable-column [width]="90" name="{{tableHead[2]}}" prop="kill"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[2]}}" prop="kill"></ngx-datatable-column>
<ngx-datatable-column [width]="104" name="{{tableHead[3]}}" prop="friendlyFire"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[3]}}" prop="friendlyFire"></ngx-datatable-column>
<ngx-datatable-column [width]="90" name="{{tableHead[4]}}" prop="vehicleLight"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[4]}}" prop="vehicleLight"></ngx-datatable-column>
<ngx-datatable-column [width]="90" name="{{tableHead[5]}}" prop="vehicleHeavy"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[5]}}" prop="vehicleHeavy"></ngx-datatable-column>
<ngx-datatable-column [width]="90" name="{{tableHead[6]}}" prop="vehicleAir"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[6]}}" prop="vehicleAir"></ngx-datatable-column>
<ngx-datatable-column [width]="80" name="{{tableHead[7]}}" prop="revive"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[7]}}" prop="revive"></ngx-datatable-column>
<ngx-datatable-column [width]="100" name="{{tableHead[8]}}" prop="flagTouch"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[8]}}" prop="flagTouch"></ngx-datatable-column>
<ngx-datatable-column [width]="70" name="{{tableHead[9]}}" prop="death"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[9]}}" prop="death"></ngx-datatable-column>
<ngx-datatable-column [width]="90" name="{{tableHead[10]}}" prop="respawn"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="{{tableHead[10]}}" prop="respawn"></ngx-datatable-column>
<!--<ngx-datatable-column [width]="80" name="" prop="name">--> <!--<ngx-datatable-column [width]="80" name="" prop="name">-->
<!--<ng-template ngx-datatable-cell-template let-value="value">--> <!--<ng-template ngx-datatable-cell-template let-value="value">-->
<!--<span class="btn btn-sm btn-default in-table-btn disabled">Detail</span>--> <!--<span class="btn btn-sm btn-default in-table-btn disabled">Detail</span>-->

View File

@ -19,8 +19,8 @@ export class ScoreboardComponent implements OnChanges {
@Output() playerTabSwitch = new EventEmitter(); @Output() playerTabSwitch = new EventEmitter();
tableHead = ['Spieler', 'Fraktion', 'Kills', 'FriendlyFire', 'Fzg(L)', 'Fzg(S)', 'Fzg(A)', tableHead = ['Spieler', 'Fraktion', 'Kills', 'FF', 'Fzg(L)', 'Fzg(H)', 'Fzg(A)',
'Revive', 'Eroberung', 'Tod', 'Respawn']; 'Revive', 'Flagge', 'Tod', 'Respawn'];
isSteamUUID = PlayerUtils.isSteamUUID; isSteamUUID = PlayerUtils.isSteamUUID;