Compare commits

..

No commits in common. "efbc078aea73966d242591889c0c68d1eb6f329e" and "24f46b0f3cb7412eba2c83d072e0fdf65edce759" have entirely different histories.

16 changed files with 84 additions and 415 deletions

View File

@ -6,14 +6,6 @@ _MEAN Application_
## Installation ## Installation
### Setup mongoDB ## Development
### Setup node and npm
## Development and Execution
### First run in dev mode
### Run in Prodction
## License Information ## License Information

View File

@ -10,7 +10,7 @@ const LogBudgetSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
fraction: { fraction: {

View File

@ -10,7 +10,7 @@ const LogFlagSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
player: { player: {

View File

@ -10,7 +10,7 @@ const LogKillSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
shooter: { shooter: {

View File

@ -10,7 +10,7 @@ const LogKillSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
ptBlufor: { ptBlufor: {

View File

@ -10,7 +10,7 @@ const LogRespawnSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
player: { player: {

View File

@ -10,7 +10,7 @@ const LogReviveSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
medic: { medic: {

View File

@ -10,7 +10,7 @@ const LogTransportSchema = new Schema({
required: true required: true
}, },
time: { time: {
type: Date, type: Number,
required: true required: true
}, },
driver: { driver: {

View File

@ -2,7 +2,6 @@
// modules // modules
const express = require('express'); const express = require('express');
const async = require('async');
const logger = require('debug')('cc:logs'); const logger = require('debug')('cc:logs');
const routerHandling = require('../middleware/router-handling'); const routerHandling = require('../middleware/router-handling');
@ -27,47 +26,18 @@ function processLogRequest(model, filter, res, next) {
err.status = require('./http-codes').notfound; err.status = require('./http-codes').notfound;
return next(err) return next(err)
} }
res.locals.items = log; const updatedTimeItems = [];
for (let i =0; i <log.length; i++) {
let item = log[i].toObject();
item.time = decimalToTimeString(item.time);
updatedTimeItems.push(item);
}
res.locals.items = updatedTimeItems;
next(); next();
}) })
} }
// routes ********************** // routes **********************
logsRouter.route('/:warId')
.get((req, res, next) => {
const filter = {war: req.params.warId};
const sort = {sort: {time: 1}};
const pointsObjects = LogPointsModel.find(filter, {}, sort);
const budgetObjects = LogBudgetModel.find(filter, {}, sort);
const respawnObjects = LogRespawnModel.find(filter, {}, sort);
const reviveObjects = LogReviveModel.find(filter, {}, sort);
const killObjects = LogKillModel.find(filter, {}, sort);
const transportObjects = LogTransportModel.find(filter, {}, sort);
const flagObjects = LogFlagModel.find(filter, {}, sort);
const resources = {
points: pointsObjects.exec.bind(pointsObjects),
budget: budgetObjects.exec.bind(budgetObjects),
respawn: respawnObjects.exec.bind(respawnObjects),
revive: reviveObjects.exec.bind(reviveObjects),
kill: killObjects.exec.bind(killObjects),
transport: transportObjects.exec.bind(transportObjects),
flag: flagObjects.exec.bind(flagObjects)
};
async.parallel(resources, function (error, results){
if (error) {
res.status(500).send(error);
return;
}
res.locals.items = results;
next();
});
})
.all(
routerHandling.httpMethodNotAllowed
);
logsRouter.route('/:warId/budget') logsRouter.route('/:warId/budget')
.get((req, res, next) => { .get((req, res, next) => {
const filter = {war: req.params.warId}; const filter = {war: req.params.warId};

View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
const timeStringToDecimal = require('../tools/util').timeStringToDecimal;
const playerArrayContains = require('./util').playerArrayContains; const playerArrayContains = require('./util').playerArrayContains;
const parseWarLog = (lineArray, war) => { const parseWarLog = (lineArray, war) => {
@ -46,7 +47,7 @@ const parseWarLog = (lineArray, war) => {
stats.kills.push({ stats.kills.push({
war: war._id, war: war._id,
time: getFullTimeDate(war.date, line.split(' ')[5]), time: timeStringToDecimal(line.split(' ')[5]),
shooter: shooter ? shooter.name : null, shooter: shooter ? shooter.name : null,
target: target.name, target: target.name,
friendlyFire: shooter ? target.fraction === shooter.fraction : false, friendlyFire: shooter ? target.fraction === shooter.fraction : false,
@ -70,7 +71,7 @@ const parseWarLog = (lineArray, war) => {
stats.war['budgetBlufor'] = transformMoneyString(budg[11]); stats.war['budgetBlufor'] = transformMoneyString(budg[11]);
stats.war['budgetOpfor'] = transformMoneyString(budg[14]); stats.war['budgetOpfor'] = transformMoneyString(budg[14]);
} else { } else {
stats.budget.push(getBudgetEntry(budg, war._id, war.date)); stats.budget.push(getBudgetEntry(budg, war._id));
} }
} }
@ -85,7 +86,7 @@ const parseWarLog = (lineArray, war) => {
stats.flag.push({ stats.flag.push({
war: war._id, war: war._id,
time: getFullTimeDate(war.date, line.split(' ')[5]), time: timeStringToDecimal(line.split(' ')[5]),
player: playerName, player: playerName,
flagFraction: flagFraction, flagFraction: flagFraction,
capture: capture capture: capture
@ -104,7 +105,7 @@ const parseWarLog = (lineArray, war) => {
stats.war['ptOpfor'] = parseInt(pt[14].slice(0, -1)); stats.war['ptOpfor'] = parseInt(pt[14].slice(0, -1));
return true; return true;
} else { } else {
stats.points.push(getPointsEntry(pt, line, war._id, war.date)) stats.points.push(getPointsEntry(pt, line, war._id))
} }
} }
@ -115,7 +116,7 @@ const parseWarLog = (lineArray, war) => {
stats.clean.push(line); stats.clean.push(line);
const resp = line.split(' '); const resp = line.split(' ');
const playerName = line.substring(line.lastIndexOf('Spieler:') + 9, line.lastIndexOf('-') - 1); const playerName = line.substring(line.lastIndexOf('Spieler:') + 9, line.lastIndexOf('-') - 1);
stats.respawn.push(getRespawnEntry(resp, playerName, war._id, war.date)); stats.respawn.push(getRespawnEntry(resp, playerName, war._id));
} }
/** /**
@ -132,7 +133,7 @@ const parseWarLog = (lineArray, war) => {
stats.revive.push({ stats.revive.push({
war: war._id, war: war._id,
time: getFullTimeDate(war.date, line.split(' ')[5]), time: timeStringToDecimal(line.split(' ')[5]),
stabilized: stabilized, stabilized: stabilized,
medic: medic.name, medic: medic.name,
patient: patient.name, patient: patient.name,
@ -155,7 +156,7 @@ const parseWarLog = (lineArray, war) => {
stats.transport.push({ stats.transport.push({
war: war._id, war: war._id,
time: getFullTimeDate(war.date, line.split(' ')[5]), time: timeStringToDecimal(line.split(' ')[5]),
driver: driver.name, driver: driver.name,
passenger: passenger ? passenger.name : null, passenger: passenger ? passenger.name : null,
fraction: driver.fraction, fraction: driver.fraction,
@ -184,28 +185,28 @@ const parseWarLog = (lineArray, war) => {
return stats; return stats;
}; };
const getRespawnEntry = (respawn, playerName, warId, warDate) => { const getRespawnEntry = (respawn, playerName, warId) => {
return { return {
war: warId, war: warId,
time: getFullTimeDate(warDate, respawn[5]), time: timeStringToDecimal(respawn[5]),
player: playerName player: playerName
} }
}; };
const getPointsEntry = (pt, line, warId, warDate) => { const getPointsEntry = (pt, line, warId) => {
return { return {
war: warId, war: warId,
time: getFullTimeDate(warDate, pt[5]), time: timeStringToDecimal(pt[5]),
ptBlufor: parseInt(pt[12]), ptBlufor: parseInt(pt[12]),
ptOpfor: parseInt(pt[15].slice(0, -1)), ptOpfor: parseInt(pt[15].slice(0, -1)),
fraction: line.includes('no Domination') ? 'NONE' : line.includes('NATO +1') ? 'BLUFOR' : 'OPFOR' fraction: line.includes('no Domination') ? 'NONE' : line.includes('NATO +1') ? 'BLUFOR' : 'OPFOR'
} }
}; };
const getBudgetEntry = (budg, warId, warDate) => { const getBudgetEntry = (budg, warId) => {
return { return {
war: warId, war: warId,
time: getFullTimeDate(warDate, budg[5]), time: timeStringToDecimal(budg[5]),
fraction: budg[9] === 'NATO' ? 'BLUFOR' : 'OPFOR', fraction: budg[9] === 'NATO' ? 'BLUFOR' : 'OPFOR',
oldBudget: transformMoneyString(budg[11]), oldBudget: transformMoneyString(budg[11]),
newBudget: transformMoneyString(budg[14]) newBudget: transformMoneyString(budg[14])
@ -228,14 +229,7 @@ const transformMoneyString = (budgetString) => {
} }
const budget = budgetString.split('e+'); const budget = budgetString.split('e+');
return Math.round(parseFloat(budget[0]) * Math.pow(10, parseInt(budget[1]))); return Math.round(parseFloat(budget[0]) * Math.pow(10, parseInt(budget[1])));
};
const getFullTimeDate = (date, timeString) => {
const returnDate = new Date(date);
const time = timeString.split(':');
returnDate.setHours(time[0]);
returnDate.setMinutes(time[1]);
return returnDate;
}; };
module.exports = parseWarLog; module.exports = parseWarLog;

View File

@ -23,7 +23,7 @@
"@angular/platform-browser": "^4.4.4", "@angular/platform-browser": "^4.4.4",
"@angular/platform-browser-dynamic": "^4.4.4", "@angular/platform-browser-dynamic": "^4.4.4",
"@angular/router": "^4.4.4", "@angular/router": "^4.4.4",
"@swimlane/ngx-charts": "^6.1.0", "@swimlane/ngx-charts": "^6.0.2",
"@swimlane/ngx-datatable": "^10.2.3", "@swimlane/ngx-datatable": "^10.2.3",
"bootstrap": "^3.3.7", "bootstrap": "^3.3.7",
"core-js": "^2.4.1", "core-js": "^2.4.1",
@ -31,7 +31,6 @@
"jquery": "^3.1.0", "jquery": "^3.1.0",
"jquery-ui": "^1.12.0", "jquery-ui": "^1.12.0",
"jquery-ui-bundle": "^1.11.4", "jquery-ui-bundle": "^1.11.4",
"ngx-bootstrap": "^1.9.3",
"ngx-clipboard": "^8.1.0", "ngx-clipboard": "^8.1.0",
"ngx-cookie-service": "^1.0.9", "ngx-cookie-service": "^1.0.9",
"ngx-infinite-scroll": "^0.5.2", "ngx-infinite-scroll": "^0.5.2",

View File

@ -10,11 +10,6 @@ export class LogsService {
private config: AppConfig) { private config: AppConfig) {
} }
getFullLog(warId: string) {
return this.http.get(this.config.apiLogsPath + '/' + warId)
.map(res => res.json())
}
getBudgetLogs(warId: string, fraction = '') { getBudgetLogs(warId: string, fraction = '') {
const params = new URLSearchParams(); const params = new URLSearchParams();
params.append('fraction', fraction); params.append('fraction', fraction);

View File

@ -43,7 +43,7 @@
} }
.chart-container { .chart-container {
width: 95%; width: 80%;
min-width: 500px; min-width: 500px;
height: 400px; height: 400px;
padding: 15px; padding: 15px;

View File

@ -10,11 +10,11 @@
<span class="text-opfor" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} CSAT</span> <span class="text-opfor" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} CSAT</span>
</div> </div>
<div class="pull-left head-field " style="padding-left: 140px;"> <div class="pull-left head-field " style="padding-left: 150px;">
<h4 style="margin-bottom: 0;">Teilnehmer:</h4> <h4 style="margin-bottom: 0;">Teilnehmer:</h4>
<ngx-charts-pie-chart <ngx-charts-pie-chart
[view]="[120, 120]" [view]="[120, 120]"
[scheme]="colorScheme" [scheme]="{domain: ['#B22222', '#0000FF']}"
[results]="playerChart" [results]="playerChart"
[legend]="false" [legend]="false"
[explodeSlices]="false" [explodeSlices]="false"
@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<tabset #staticTabs> <tabset>
<tab> <tab>
<ng-template tabHeading> <ng-template tabHeading>
<img src="../../../assets/scoreboard-btn.png"> Scoreboard <img src="../../../assets/scoreboard-btn.png"> Scoreboard
@ -101,7 +101,6 @@
[gradient]="gradient" [gradient]="gradient"
[xAxis]="xAxis" [xAxis]="xAxis"
[yAxis]="yAxis" [yAxis]="yAxis"
[curve]="monotoneYCurve"
[legend]="legend" [legend]="legend"
[legendTitle]="legendTitle" [legendTitle]="legendTitle"
[showXAxisLabel]="showXAxisLabel" [showXAxisLabel]="showXAxisLabel"
@ -119,7 +118,6 @@
[gradient]="gradient" [gradient]="gradient"
[xAxis]="xAxis" [xAxis]="xAxis"
[yAxis]="yAxis" [yAxis]="yAxis"
[curve]="monotoneYCurve"
[legend]="legend" [legend]="legend"
[legendTitle]="legendTitle" [legendTitle]="legendTitle"
[showXAxisLabel]="showXAxisLabel" [showXAxisLabel]="showXAxisLabel"
@ -130,113 +128,6 @@
[roundDomains]="roundDomains"> [roundDomains]="roundDomains">
</ngx-charts-line-chart> </ngx-charts-line-chart>
</div> </div>
<div class="fade-in chart-container">
<ngx-charts-line-chart
[scheme]="colorScheme"
[results]="killData"
[gradient]="gradient"
[xAxis]="xAxis"
[yAxis]="yAxis"
[curve]="monotoneYCurve"
[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"
[curve]="monotoneYCurve"
[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"
[curve]="monotoneYCurve"
[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"
[curve]="monotoneYCurve"
[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"
[curve]="monotoneYCurve"
[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-line-chart
[scheme]="colorScheme"
[results]="flagData"
[xAxis]="xAxis"
[yAxis]="yAxis"
[curve]="stepCurve"
[legend]="legend"
[legendTitle]="legendTitle"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[yAxisLabel]="yAxisLabelFlag"
[autoScale]="autoscale"
[timeline]="timeline"
[roundDomains]="roundDomains">
</ngx-charts-line-chart>
</div>
</tab> </tab>
</tabset> </tabset>

View File

@ -3,8 +3,6 @@ import {ActivatedRoute, Router} from "@angular/router";
import {WarService} from "../../services/logs/war.service"; import {WarService} from "../../services/logs/war.service";
import {War} from "../../models/model-interfaces"; 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 * as d3 from "d3";
@Component({ @Component({
@ -14,16 +12,14 @@ import * as d3 from "d3";
}) })
export class WarDetailComponent { export class WarDetailComponent {
@ViewChild('overview') private overviewContainer: ElementRef;
@ViewChild('staticTabs') staticTabs: TabsetComponent;
war: War = {players: []}; war: War = {players: []};
fractionRadioSelect: string; fractionRadioSelect: string;
playerChart: any[] = []; playerChart: any[] = [];
@ViewChild('overview') private overviewContainer: ElementRef;
cellHeight = 40; cellHeight = 40;
rows = []; rows = [];
@ -37,21 +33,6 @@ export class WarDetailComponent {
pointData: any[] = []; pointData: any[] = [];
budgetData: any[] = []; budgetData: any[] = [];
killData: any[] = [];
friendlyFireData: any[] = [];
transportData: any[] = [];
reviveData: any[] = [];
stabilizedData: any[] = [];
flagData: any[] = [];
tmpPointData;
tmpBudgetData;
tmpKillData;
tmpFrienlyFireData;
tmpTransportData;
tmpReviveData;
tmpStabilizeData;
tmpFlagCaptureData;
colorScheme = { colorScheme = {
domain: ['#0000FF', '#B22222'] domain: ['#0000FF', '#B22222']
@ -59,15 +40,7 @@ export class WarDetailComponent {
yAxisLabelPoints = 'Punkte'; yAxisLabelPoints = 'Punkte';
yAxisLabelBudget = 'Budget'; yAxisLabelBudget = 'Budget';
yAxisLabelKill = 'Kills';
yAxisLabelFriendlyFire = 'FriendlyFire';
yAxisLabelTransport = 'Lufttransport';
yAxisLabelRevive = 'Revive';
yAxisLabelStabilize = 'Stabilisiert';
yAxisLabelFlag = 'Flaggenbesitz';
monotoneYCurve = d3.curveMonotoneY;
stepCurve = d3.curveStepAfter;
gradient = false; gradient = false;
yAxis = true; yAxis = true;
xAxis = true; xAxis = true;
@ -78,7 +51,7 @@ export class WarDetailComponent {
autoscale = true; autoscale = true;
timeline = false; timeline = false;
roundDomains = true; roundDomains = true;
fractionChartsInitialized: boolean = false; fractionInitialized: boolean = false;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
@ -104,29 +77,7 @@ export class WarDetailComponent {
"value": war.playersBlufor "value": war.playersBlufor
} }
]; ];
this.tmpPointData = [ Object.assign(this, [this.playerChart, this.pointData, this.budgetData]);
{
"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.friendlyFireData, this.transportData, this.reviveData, this.stabilizedData, this.flagData]);
this.fractionChartsInitialized = false;
this.staticTabs.tabs[0].active = true;
this.scrollOverviewTop(); this.scrollOverviewTop();
}); });
} }
@ -156,194 +107,71 @@ export class WarDetailComponent {
} }
loadFractionData() { loadFractionData() {
if (!this.fractionChartsInitialized) { if (!this.fractionInitialized) {
const startDateObj = new Date(this.war.date); const tmpPointData = [
startDateObj.setHours(0); {
startDateObj.setMinutes(1); "name": "NATO",
"series": []
},
{
"name": "CSAT",
"series": []
}
];
const tmpBudgetData = JSON.parse(JSON.stringify(tmpPointData));
const tmpKillData = JSON.parse(JSON.stringify(tmpPointData));
const tmpFrienlyFireData = JSON.parse(JSON.stringify(tmpPointData));
const tmpTransportData = JSON.parse(JSON.stringify(tmpPointData));
const tmpReviveData = JSON.parse(JSON.stringify(tmpPointData));
const tmpStabilizeData = JSON.parse(JSON.stringify(tmpPointData));
const tmpFlagCaptureData = JSON.parse(JSON.stringify(tmpPointData));
this.logsService.getFullLog(this.war._id).subscribe((data) => { // POINTS
// POINTS this.logsService.getPointsLogs(this.war._id).subscribe((data) => {
data.points.forEach(pointEntry => { data.forEach(pointEntry => {
const dateObj = new Date(this.war.date); const dateObj = new Date(this.war.date);
const time = pointEntry.time.split(':'); const time = pointEntry.time.split(':');
dateObj.setHours(time[0]); dateObj.setHours(time[0]);
dateObj.setMinutes(time[1]); dateObj.setMinutes(time[1]);
this.tmpPointData[0].series.push({ tmpPointData[0].series.push({
"name": new Date(pointEntry.time), "name": dateObj,
"value": pointEntry.ptBlufor "value": pointEntry.ptBlufor
}); });
this.tmpPointData[1].series.push({ tmpPointData[1].series.push({
"name": new Date(pointEntry.time), "name": dateObj,
"value": pointEntry.ptOpfor "value": pointEntry.ptOpfor
}); });
}); });
this.pointData = this.tmpPointData; this.pointData = tmpPointData;
});
// BUDGET // BUDGET
this.tmpBudgetData[0].series.push({ this.logsService.getBudgetLogs(this.war._id).subscribe((data) => {
"name": startDateObj, const dateObj = new Date(this.war.date);
dateObj.setHours(0);
dateObj.setMinutes(0);
tmpBudgetData[0].series.push({
"name": dateObj,
"value": this.war.budgetBlufor "value": this.war.budgetBlufor
}); });
this.tmpBudgetData[1].series.push({ tmpBudgetData[1].series.push({
"name": startDateObj, "name": dateObj,
"value": this.war.budgetOpfor "value": this.war.budgetOpfor
}); });
data.budget.forEach(budgetEntry => { data.forEach(budgetEntry => {
this.tmpBudgetData[budgetEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({ const time = budgetEntry.time.split(':');
"name": new Date(budgetEntry.time), const dateObj = new Date(this.war.date);
dateObj.setHours(time[0]);
dateObj.setMinutes(time[1]);
tmpBudgetData[budgetEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
"name": dateObj,
"value": budgetEntry.newBudget "value": budgetEntry.newBudget
}); });
}); });
this.budgetData = this.tmpBudgetData; this.budgetData = tmpBudgetData;
// KILLS
let killCountBlufor = 0;
let killCountOpfor = 0;
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 => {
if (killEntry.fraction === 'BLUFOR') {
if (killEntry.friendlyFire === false) {
killCountBlufor++;
} else {
ffKillCountBlufor++;
}
} else {
if (killEntry.friendlyFire === false) {
killCountOpfor++;
} else {
ffKillCountOpfor++;
}
}
this.tmpKillData[killEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
"name": new Date(killEntry.time),
"value": killEntry.fraction === 'BLUFOR' ? killCountBlufor : killCountOpfor
});
this.tmpFrienlyFireData[killEntry.fraction === 'BLUFOR' ? 0 : 1].series.push({
"name": new Date(killEntry.time),
"value": killEntry.fraction === 'BLUFOR' ? ffKillCountBlufor : ffKillCountOpfor
});
});
this.killData = this.tmpKillData;
this.friendlyFireData = this.tmpFrienlyFireData;
// TRANSPORT
let transportCountBlufor = 0;
let transportCountOpfor = 0;
this.tmpTransportData[0].series.push({
"name": startDateObj,
"value": transportCountBlufor
});
this.tmpTransportData[1].series.push({
"name": startDateObj,
"value": transportCountOpfor
});
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
});
});
this.transportData = this.tmpTransportData;
// REVIVE & STABILIZE
let reviveCountBlufor = 0;
let reviveCountOpfor = 0;
let stabilizeCountBlufor = 0;
let stabilizeCountOpfor = 0;
this.tmpReviveData[0].series.push({
"name": startDateObj,
"value": reviveCountBlufor
});
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 {
reviveCountOpfor++;
}
} else {
if (reviveEntry.stabilized === false) {
stabilizeCountBlufor++;
} 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
});
});
this.reviveData = this.tmpReviveData;
this.stabilizedData = this.tmpStabilizeData;
// FLAG
let flagStatusBlufor = 1;
let flagStatusOpfor = 1;
this.tmpFlagCaptureData[0].series.push({
"name": startDateObj,
"value": flagStatusBlufor
});
this.tmpFlagCaptureData[1].series.push({
"name": startDateObj,
"value": flagStatusOpfor
});
data.flag.forEach(flagEntry => {
if (flagEntry.flagFraction === 'BLUFOR') {
flagStatusBlufor = flagEntry.capture ? 0 : 1
} else {
flagStatusOpfor = flagEntry.capture ? 0 : 1;
}
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push({
"name": new Date(flagEntry.time),
"value": flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor
});
});
this.flagData = this.tmpFlagCaptureData;
this.fractionChartsInitialized = true;
}); });
this.fractionInitialized = true;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB