diff --git a/api/routes/wars.js b/api/routes/wars.js index d50277c..e57fcf4 100644 --- a/api/routes/wars.js +++ b/api/routes/wars.js @@ -82,7 +82,6 @@ wars.route('/') if (err) { return next(err); } - //TODO: combine run and clean in one script, so log file gets touched only once exec(__dirname + '/../war-parser/run.sh ' + folderName + ' ' + war._id, (error, stdout) => { if (error) { return next(error); @@ -93,7 +92,9 @@ wars.route('/') } let obj = JSON.parse(`${stdout}`); for (let i = 0; i < obj.length; i++) { - if (obj[i].fraction === 'BLUFOR') { + if (!obj[i].fraction) { + obj.splice(i, 1); + } else if (obj[i].fraction === 'BLUFOR') { war.playersBlufor++; } else { war.playersOpfor++;