commit
ec2beb56a0
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "opt-cc",
|
"name": "opt-cc",
|
||||||
"version": "1.9.0",
|
"version": "1.9.1",
|
||||||
"author": "Florian Hartwich <hardi@noarch.de>",
|
"author": "Florian Hartwich <hardi@noarch.de>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -417,7 +417,12 @@ const getBudgetEntry = (budg, warId, warDate) => {
|
||||||
|
|
||||||
const getPlayerInfoFromString = (inputString) => {
|
const getPlayerInfoFromString = (inputString) => {
|
||||||
const resPlayer = {};
|
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);
|
const sideMatch = sideRegex.exec(inputString);
|
||||||
|
|
||||||
// SINGLE PLAYER NAME
|
// SINGLE PLAYER NAME
|
||||||
|
@ -426,11 +431,11 @@ const getPlayerInfoFromString = (inputString) => {
|
||||||
name = playerNameRegexMatch[2].trim();
|
name = playerNameRegexMatch[2].trim();
|
||||||
// do not return player for 'unbekannt' or 'Error: No unit'
|
// do not return player for 'unbekannt' or 'Error: No unit'
|
||||||
if (!name || name === 'unbekannt' || name === 'Error: No unit' || name === 'Selbstverschulden.') {
|
if (!name || name === 'unbekannt' || name === 'Error: No unit' || name === 'Selbstverschulden.') {
|
||||||
return;
|
return {name: 'UNKNOWN', fraction: 'NONE'};
|
||||||
}
|
}
|
||||||
resPlayer.name = name;
|
resPlayer.name = name;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return {name: 'UNKNOWN', fraction: 'NONE'};
|
||||||
}
|
}
|
||||||
|
|
||||||
// ADDITIONAL PLAYER NAMES
|
// ADDITIONAL PLAYER NAMES
|
||||||
|
|
Loading…
Reference in New Issue