diff --git a/README.md b/README.md index c9778a0..49b76af 100644 --- a/README.md +++ b/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 diff --git a/api/models/war.js b/api/models/war.js index d059d44..7d4cf9c 100644 --- a/api/models/war.js +++ b/api/models/war.js @@ -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'} diff --git a/api/tools/log-parse-tool.js b/api/tools/log-parse-tool.js index e363b90..06fa9ec 100644 --- a/api/tools/log-parse-tool.js +++ b/api/tools/log-parse-tool.js @@ -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]); diff --git a/static/src/app/models/model-interfaces.ts b/static/src/app/models/model-interfaces.ts index 968b672..4830267 100644 --- a/static/src/app/models/model-interfaces.ts +++ b/static/src/app/models/model-interfaces.ts @@ -46,6 +46,7 @@ export interface War { _id?: string; title?: string; date?: string; + endDate?: string; ptBlufor?: number; ptOpfor?: number; playersBlufor?: number; diff --git a/static/src/app/statistic/war-detail/war-detail.component.css b/static/src/app/statistic/war-detail/war-detail.component.css index a249eb6..00eaf09 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.css +++ b/static/src/app/statistic/war-detail/war-detail.component.css @@ -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; } diff --git a/static/src/app/statistic/war-detail/war-detail.component.html b/static/src/app/statistic/war-detail/war-detail.component.html index 4d5e279..64ab7dd 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.html +++ b/static/src/app/statistic/war-detail/war-detail.component.html @@ -221,7 +221,7 @@
- - +
diff --git a/static/src/app/statistic/war-detail/war-detail.component.ts b/static/src/app/statistic/war-detail/war-detail.component.ts index 10833f8..232dc44 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.ts +++ b/static/src/app/statistic/war-detail/war-detail.component.ts @@ -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; + } + }