fix log parser; readjust war detail view

pull/15/head
HardiReady 2017-10-28 12:58:40 +02:00
parent d3f3b3410a
commit 55a4662b40
10 changed files with 29 additions and 17 deletions

View File

@ -3,6 +3,7 @@
"licence": "CC BY-SA 4.0",
"description": "RESTful API for Operation Pandora Trigger Command Center, includes signature generator",
"main": "server.js",
"author": "Florian Hartwich <hardi@noarch.de>",
"private": true,
"scripts": {
"start": "NODE_ENV=production node server.js",

View File

@ -150,7 +150,7 @@ wars.route('/:id')
err.status = codes.notfound;
return next(err);
}
PlayerModel.find({warId: item._id}, {}, {sort: {sort: 'desc'}}, (err, items) => {
PlayerModel.find({warId: item._id}, {}, {sort: {kill: 'desc'}}, (err, items) => {
if (err) {
return next(err);
}

View File

@ -1,7 +1,7 @@
'use strict';
const timeStringToDecimal = require('../tools/util').timeStringToDecimal;
const arrayContains = require('./util').arrayContains;
const playerArrayContains = require('./util').playerArrayContains;
const parseWarLog = (lineArray, war) => {
const nameToLongError = 'Error: ENAMETOOLONG: name too long, open \'';
@ -20,7 +20,7 @@ const parseWarLog = (lineArray, war) => {
const addPlayersIfNotExists = (inputPlayers) => {
inputPlayers.forEach(player => {
if (player && player.name && player.fraction && !arrayContains(stats.players, player)) {
if (player && player.name && player.fraction && !playerArrayContains(stats.players, player)) {
player['warId'] = war._id;
stats.players.push(player);
}

View File

@ -11,11 +11,11 @@ const sortCollectionBy = (collection, key) => {
return collection;
};
const arrayContains = (arr, item) => {
const playerArrayContains = (arr, item) => {
let i = 0, count = arr.length, matchFound = false;
for (; i < count; i++) {
if (arr[i] === item) {
if (arr[i].name === item.name && arr[i].fraction === item.fraction) {
matchFound = true;
break;
}
@ -45,6 +45,6 @@ const decimalToTimeString = (decimal) => {
};
exports.sortCollection = sortCollectionBy;
exports.arrayContains = arrayContains;
exports.playerArrayContains = playerArrayContains;
exports.timeStringToDecimal = timeStringToDecimal;
exports.decimalToTimeString = decimalToTimeString;

View File

@ -2,6 +2,7 @@
"name": "opt-cc",
"version": "1.6.0",
"license": "MIT",
"author": "Florian Hartwich <hardi@noarch.de>",
"private": true,
"scripts": {
"start": "npm run deploy-static-prod && npm start --prefix ./api",

View File

@ -1,6 +1,7 @@
{
"name": "opt-cc-static",
"license": "MIT",
"author": "Florian Hartwich <hardi@noarch.de>",
"private": true,
"angular-cli": {},
"scripts": {
@ -30,7 +31,6 @@
"jquery": "^3.1.0",
"jquery-ui": "^1.12.0",
"jquery-ui-bundle": "^1.11.4",
"ngx-bootstrap": "^2.0.0-beta.6",
"ngx-clipboard": "^8.1.0",
"ngx-cookie-service": "^1.0.9",
"ngx-infinite-scroll": "^0.5.2",

View File

@ -91,6 +91,10 @@ export class CampaignPlayerDetailComponent {
this.reviveData = this.assignData(this.yAxisRevive, "revive");
this.captureData = this.assignData(this.yAxisCapture, "flagTouch");
if (this.totalDeath === 0) {
// avoid infinite or NaN with no death
this.totalDeath = 1;
}
this.kdRatio = parseFloat((this.totalKills / this.totalDeath).toFixed(2));
if (this.kdRatio > 1) this.maxKd = this.kdRatio * 1.7;

View File

@ -4,6 +4,12 @@
width: 4%;
}
.head-field {
font-size: 24px;
margin-top: 10px;
margin-bottom: 10px;
}
@media screen and (min-width: 1500px) {
.vertical-spacer {
width: 15%;

View File

@ -2,19 +2,19 @@
<div class=vertical-spacer>
</div>
<div style="overflow:hidden">
<div style="width: 920px;min-height: 263px;">
<div style="width: 920px;min-height: 205px;">
<h2>{{war.title}} - vom {{war.date | date: 'dd.MM.yyyy'}}</h2>
<h3 class="pull-left" style="width: 250px">
<div class="pull-left head-field" style="width: 250px">
<h4>Endpunktestand:</h4>
<span class="text-blufor" style="font-weight: bold; margin-right: 10px">NATO {{war.ptBlufor}}</span>
<span style="font-size: x-large">|</span>
<span class="text-opfor" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} CSAT</span>
</h3>
</div>
<h3 class="pull-left" style="padding-left: 150px;">
<h4>Teilnehmer:</h4>
<div class="pull-left head-field " style="padding-left: 150px;">
<h4 style="margin-bottom: 0;">Teilnehmer:</h4>
<ngx-charts-pie-chart
[view]="[150, 150]"
[view]="[120, 120]"
[scheme]="{domain: ['#B22222', '#0000FF']}"
[results]="playerChart"
[legend]="false"
@ -23,7 +23,7 @@
[doughnut]="false"
[gradient]="false">
</ngx-charts-pie-chart>
</h3>
</div>
<div class="pull-left " style="padding-left: 150px; padding-top:15px">
<a class="btn btn-default" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log">Logfile
@ -52,9 +52,9 @@
</div>
</div>
<!--may be added in future: [sorts]="[{prop: 'sort', dir: 'desc'}]"-->
<ngx-datatable
[rows]="rows"
[sorts]="[{prop: 'kill', dir: 'desc'}]"
[reorderable]="reorderable"
[messages]="{emptyMessage: 'Loading...'}"
[headerHeight]="cellHeight"

View File

@ -26,7 +26,7 @@ div.user-list-entry, a.user-list-entry {
background: lightgrey;
}
span {
span > a, span.glyphicon, span.icon-award{
cursor: pointer;
}