Compare commits

..

No commits in common. "278e130614313d8ed1b43d051822f000b9f80b4d" and "e263ce050ac42d020dd0b9e1dbd8607684fe7726" have entirely different histories.

4 changed files with 41 additions and 100 deletions

View File

@ -176,15 +176,8 @@ wars.route('/:id')
return next(err);
}
// delete linked appearances
// delete players having this war ID as foreign key
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
const warDir = __dirname + '/../resource/logs/' + req.params.id;

View File

@ -54,7 +54,7 @@
}
:host /deep/ .nav-link:hover {
background: #afafaf;
background: #286090;
color: #000;
}
@ -100,21 +100,6 @@
/* ########### 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%;
@ -132,6 +117,6 @@
vertical-align: middle;
}
/*.dropdown-menu > li > a {*/
/*cursor: pointer;*/
/*}*/
.dropdown-menu > li > a {
cursor: pointer;
}

View File

@ -29,7 +29,7 @@
'left=20,top=20,width=1380,height=600,toolbar=1,resizable=0'); return false;"
href="resource/logs/{{war._id}}/clean.log">
Logfile anzeigen</a>
<form *ngIf="staticTabs.tabs[0].active" class="form-group">
<form class="form-group">
<label class="radio-inline">
<input type="radio" name="fractSelect"
[checked]="(fractionRadioSelect == undefined) ? 'true' : 'false'"
@ -117,16 +117,16 @@
<!--</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"
<label class="btn btn-default" [(ngModel)]="chartSelectModel" btnRadio="{{labelPoints}}">{{labelPoints}}</label>
<label class="btn btn-default" [(ngModel)]="chartSelectModel" btnRadio="{{labelBudget}}">{{labelBudget}}</label>
<label class="btn btn-default" [(ngModel)]="chartSelectModel" btnRadio="{{labelKill}}">{{labelKill}}</label>
<label class="btn btn-default" [(ngModel)]="chartSelectModel" btnRadio="{{labelFriendlyFire}}">{{labelFriendlyFire}}</label>
<label class="btn btn-default" [(ngModel)]="chartSelectModel" btnRadio="{{labelRevive}}">{{labelRevive}}</label>
<label class="btn btn-default" [(ngModel)]="chartSelectModel"
btnRadio="{{labelStabilize}}">{{labelStabilize}}</label>
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
<label class="btn btn-default" [(ngModel)]="chartSelectModel"
btnRadio="{{labelTransport}}">{{labelTransport}}</label>
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel" btnRadio="{{labelFlag}}">{{labelFlag}}</label>
<label class="btn btn-default" [(ngModel)]="chartSelectModel" btnRadio="{{labelFlag}}">{{labelFlag}}</label>
</div>
<div *ngIf="showLineChart" class="chart-container">

View File

@ -51,8 +51,6 @@ export class WarDetailComponent {
tmpStabilizeData;
tmpFlagCaptureData;
initialized;
colorScheme = {
domain: ['#0000FF', '#B22222']
};
@ -79,6 +77,7 @@ export class WarDetailComponent {
autoscale = true;
timeline = false;
roundDomains = true;
fractionChartsInitialized: boolean = false;
startDateObj;
@ -102,14 +101,7 @@ export class WarDetailComponent {
this.rows = war.players;
this.playerChart = ChartUtils.getSingleDataArray('CSAT', war.playersOpfor, 'NATO', war.playersBlufor);
this.initialized = {
basic: false,
budget: false,
kill: false,
revive: false,
transport: false,
flag: false
};
this.fractionChartsInitialized = false;
Object.assign(this, [this.playerChart, this.lineChartData, this.areaChartData]);
this.chartSelectModel = this.labelPoints;
@ -142,32 +134,25 @@ export class WarDetailComponent {
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;
}
@ -195,7 +180,7 @@ export class WarDetailComponent {
}
loadFractionData() {
if (this.initialized.basic) {
if (this.fractionChartsInitialized) {
return;
}
@ -203,11 +188,17 @@ export class WarDetailComponent {
this.logsService.getFullLog(this.war._id).subscribe((data) => {
this.logData = data;
this.initPointData();
this.showLineChart = true;
this.lineChartLabel = this.labelPoints;
this.lineChartData = this.tmpPointData;
this.initialized.basic = true;
this.initBudgetData();
this.initKillData();
this.initRevive();
this.initTransportData();
this.initFlagHoldData();
this.addFinalTimeDataEntriesAndPopulate(new Date(this.war.endDate));
this.fractionChartsInitialized = true;
});
}
@ -216,13 +207,9 @@ export class WarDetailComponent {
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);
}
initBudgetData() {
if (this.initialized.budget) {
return;
}
this.logData.budget.forEach(budgetEntry => {
const budgetEntryDate = new Date(budgetEntry.time);
const fractionChange = budgetEntry.fraction === 'BLUFOR' ? 0 : 1;
@ -234,14 +221,9 @@ export class WarDetailComponent {
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}))) {
@ -276,16 +258,9 @@ export class WarDetailComponent {
this.tmpFrienlyFireData[1].series.push(ChartUtils.getSeriesEntry(killEntryDate, ffKillCountOpfor));
}
}
this.addFinalTimeData(this.tmpKillData);
this.addFinalTimeData(this.tmpFrienlyFireData)
this.initialized.kill = true;
}
initRevive() {
if (this.initialized.revive) {
return;
}
let reviveCountBlufor = 0, reviveCountOpfor = 0, stabilizeCountBlufor = 0, stabilizeCountOpfor = 0;
for (const {reviveEntry, index} of this.logData.revive.map((reviveEntry, index) => ({reviveEntry, index}))) {
const reviveEntryDate = new Date(reviveEntry.time);
@ -317,15 +292,9 @@ export class WarDetailComponent {
this.tmpStabilizeData[1].series.push(ChartUtils.getSeriesEntry(reviveEntryDate, stabilizeCountOpfor));
}
}
this.addFinalTimeData(this.tmpReviveData);
this.addFinalTimeData(this.tmpStabilizeData);
this.initialized.revive = true;
}
initTransportData() {
if (this.initialized.transport) {
return;
}
let transportCountBlufor = 0, transportCountOpfor = 0;
for (const {transportEntry, index} of this.logData.transport.map((transportEntry, index) => ({
transportEntry,
@ -342,15 +311,9 @@ export class WarDetailComponent {
this.tmpTransportData[1].series.push(ChartUtils.getSeriesEntry(transportEntryDate, transportCountOpfor));
}
}
this.addFinalTimeData(this.tmpTransportData);
this.initialized.transport = true;
}
initFlagHoldData() {
if (this.initialized.flag) {
return;
}
let flagStatusBlufor = true;
let flagStatusOpfor = true;
this.tmpFlagCaptureData[0].series.push(ChartUtils.getSeriesEntry(this.startDateObj, flagStatusBlufor));
@ -358,17 +321,14 @@ export class WarDetailComponent {
this.logData.flag.forEach(flagEntry => {
if (flagEntry.flagFraction === 'BLUFOR') {
flagStatusBlufor = !flagEntry.capture;
flagStatusBlufor = !flagEntry.capture
} else {
flagStatusOpfor = !flagEntry.capture;
}
this.tmpFlagCaptureData[flagEntry.flagFraction === 'BLUFOR' ? 0 : 1].series.push(
ChartUtils.getSeriesEntry(new Date(flagEntry.time), flagEntry.flagFraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor)
ChartUtils.getSeriesEntry(new Date(flagEntry.time), flagEntry.fraction === 'BLUFOR' ? flagStatusBlufor : flagStatusOpfor)
)
});
this.addFinalTimeData(this.tmpFlagCaptureData);
this.initialized.flag = true;
}
private static isTwoMinutesAhead(entryDate: Date, tmpData: any): boolean {
@ -394,18 +354,21 @@ export class WarDetailComponent {
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) {
addFinalTimeDataEntriesAndPopulate(endDate) {
[this.tmpPointData, 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(ChartUtils.getSeriesEntry(endDate, tmp[j].series[tmp[j].series.length - 1].value));
}
}
});
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));
}
}
}
this.showLineChart = true;
this.lineChartLabel = this.labelPoints;
this.lineChartData = this.tmpPointData;
}
}