Merge branch 'release/v1.9.1' of hardi/opt-cc into master

pull/55/head v1.9.1
hardi 2019-02-14 21:00:15 +01:00 committed by Gogs
commit ec2beb56a0
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "opt-cc",
"version": "1.9.0",
"version": "1.9.1",
"author": "Florian Hartwich <hardi@noarch.de>",
"private": true,
"scripts": {

View File

@ -417,7 +417,12 @@ const getBudgetEntry = (budg, warId, warDate) => {
const getPlayerInfoFromString = (inputString) => {
const resPlayer = {};
const playerNameRegexMatch = playerNameRegex.exec(inputString);
let playerNameRegexMatch = playerNameRegex.exec(inputString);
// https://stackoverflow.com/questions/18462784/why-is-javascript-regex-matching-every-second-time
if (!playerNameRegexMatch) {
playerNameRegexMatch = playerNameRegex.exec(inputString);
}
const sideMatch = sideRegex.exec(inputString);
// SINGLE PLAYER NAME
@ -426,11 +431,11 @@ const getPlayerInfoFromString = (inputString) => {
name = playerNameRegexMatch[2].trim();
// do not return player for 'unbekannt' or 'Error: No unit'
if (!name || name === 'unbekannt' || name === 'Error: No unit' || name === 'Selbstverschulden.') {
return;
return {name: 'UNKNOWN', fraction: 'NONE'};
}
resPlayer.name = name;
} else {
return;
return {name: 'UNKNOWN', fraction: 'NONE'};
}
// ADDITIONAL PLAYER NAMES