From 4d72a7d02f74f4ea3171382ba9750e2593de13d5 Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 13 Aug 2017 09:16:03 +0200 Subject: [PATCH] fix no faction war submit 500 --- api/routes/wars.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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++;