Release v1.6.0 - Detail parsing & fraction war stats #15
20
README.md
20
README.md
|
@ -8,12 +8,30 @@ _MEAN Application_
|
|||
|
||||
### Setup mongoDB
|
||||
|
||||
https://docs.mongodb.com/manual/administration/install-community/
|
||||
|
||||
### Setup node and npm
|
||||
|
||||
sudo apt-get install npm nodejs-legacy
|
||||
|
||||
update to latest npm version
|
||||
|
||||
sudo npm install -g npm@latest
|
||||
|
||||
update node to latest version
|
||||
|
||||
sudo npm install -g n@latest
|
||||
n latest
|
||||
|
||||
check versions
|
||||
|
||||
npm -v
|
||||
node -v
|
||||
|
||||
## Development and Execution
|
||||
|
||||
### First run in dev mode
|
||||
|
||||
### Run in Prodction
|
||||
### Run in Production
|
||||
|
||||
## License Information
|
||||
|
|
|
@ -11,6 +11,10 @@ const WarSchema = new Schema({
|
|||
date: {
|
||||
type: Date,
|
||||
},
|
||||
endDate : {
|
||||
type: Date,
|
||||
required: true
|
||||
},
|
||||
ptBlufor: {
|
||||
type: Number,
|
||||
get: v => Math.round(v),
|
||||
|
@ -61,7 +65,7 @@ const WarSchema = new Schema({
|
|||
get: v => Math.round(v),
|
||||
set: v => Math.round(v),
|
||||
default: 0
|
||||
},
|
||||
}
|
||||
}, {
|
||||
collection: 'war',
|
||||
timestamps: {createdAt: 'timestamp'}
|
||||
|
|
|
@ -65,6 +65,9 @@ const parseWarLog = (lineArray, war) => {
|
|||
if (line.includes('Endbudget')) {
|
||||
stats.war['endBudgetBlufor'] = transformMoneyString(budg[11]);
|
||||
stats.war['endBudgetOpfor'] = transformMoneyString(budg[14]);
|
||||
console.log(budg)
|
||||
console.log(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T' + budg[5] +'.000+02:00')
|
||||
war.endDate = new Date(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T0' + budg[5] +'.000+02:00');
|
||||
} else if (line.includes('Startbudget')) {
|
||||
stats.war.date = new Date(budg[0].substr(0, budg[0].length - 1).split('/').join('-') + 'T22:00:00.000+02:00');
|
||||
stats.war['budgetBlufor'] = transformMoneyString(budg[11]);
|
||||
|
|
|
@ -46,6 +46,7 @@ export interface War {
|
|||
_id?: string;
|
||||
title?: string;
|
||||
date?: string;
|
||||
endDate?: string;
|
||||
ptBlufor?: number;
|
||||
ptOpfor?: number;
|
||||
playersBlufor?: number;
|
||||
|
|
|
@ -43,11 +43,11 @@
|
|||
}
|
||||
|
||||
.chart-container {
|
||||
width: 95%;
|
||||
min-width: 500px;
|
||||
width: 90%;
|
||||
margin: 2%;
|
||||
min-width: 900px;
|
||||
height: 400px;
|
||||
padding: 15px;
|
||||
margin: 2%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@
|
|||
</ngx-charts-line-chart>
|
||||
</div>
|
||||
<div class="fade-in chart-container">
|
||||
<ngx-charts-line-chart
|
||||
<ngx-charts-area-chart
|
||||
[scheme]="colorScheme"
|
||||
[results]="flagData"
|
||||
[xAxis]="xAxis"
|
||||
|
@ -235,7 +235,7 @@
|
|||
[autoScale]="autoscale"
|
||||
[timeline]="timeline"
|
||||
[roundDomains]="roundDomains">
|
||||
</ngx-charts-line-chart>
|
||||
</ngx-charts-area-chart>
|
||||
</div>
|
||||
</tab>
|
||||
</tabset>
|
||||
|
|
|
@ -177,7 +177,6 @@ export class WarDetailComponent {
|
|||
"value": pointEntry.ptOpfor
|
||||
});
|
||||
});
|
||||
this.pointData = this.tmpPointData;
|
||||
|
||||
// BUDGET
|
||||
this.tmpBudgetData[0].series.push({
|
||||
|
@ -194,7 +193,6 @@ export class WarDetailComponent {
|
|||
"value": budgetEntry.newBudget
|
||||
});
|
||||
});
|
||||
this.budgetData = this.tmpBudgetData;
|
||||
|
||||
// KILLS
|
||||
let killCountBlufor = 0;
|
||||
|
@ -241,8 +239,6 @@ export class WarDetailComponent {
|
|||
"value": killEntry.fraction === 'BLUFOR' ? ffKillCountBlufor : ffKillCountOpfor
|
||||
});
|
||||
});
|
||||
this.killData = this.tmpKillData;
|
||||
this.friendlyFireData = this.tmpFrienlyFireData;
|
||||
|
||||
// TRANSPORT
|
||||
let transportCountBlufor = 0;
|
||||
|
@ -267,7 +263,6 @@ export class WarDetailComponent {
|
|||
"value": transportEntry.fraction === 'BLUFOR' ? transportCountBlufor : transportCountOpfor
|
||||
});
|
||||
});
|
||||
this.transportData = this.tmpTransportData;
|
||||
|
||||
// REVIVE & STABILIZE
|
||||
let reviveCountBlufor = 0;
|
||||
|
@ -313,13 +308,10 @@ export class WarDetailComponent {
|
|||
"value": reviveEntry.fraction === 'BLUFOR' ? stabilizeCountBlufor : stabilizeCountOpfor
|
||||
});
|
||||
});
|
||||
this.reviveData = this.tmpReviveData;
|
||||
this.stabilizedData = this.tmpStabilizeData;
|
||||
|
||||
|
||||
// FLAG
|
||||
let flagStatusBlufor = 1;
|
||||
let flagStatusOpfor = 1;
|
||||
let flagStatusBlufor = true;
|
||||
let flagStatusOpfor = true;
|
||||
this.tmpFlagCaptureData[0].series.push({
|
||||
"name": startDateObj,
|
||||
"value": flagStatusBlufor
|
||||
|
@ -331,20 +323,44 @@ export class WarDetailComponent {
|
|||
|
||||
data.flag.forEach(flagEntry => {
|
||||
if (flagEntry.flagFraction === 'BLUFOR') {
|
||||
flagStatusBlufor = flagEntry.capture ? 0 : 1
|
||||
flagStatusBlufor = !flagEntry.capture
|
||||
} else {
|
||||
flagStatusOpfor = flagEntry.capture ? 0 : 1;
|
||||
flagStatusOpfor = !flagEntry.capture;
|
||||
}
|
||||
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.addFinalTimeDataEntriesAndPopulate(new Date(this.war.endDate));
|
||||
|
||||
this.fractionChartsInitialized = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue