Fix log parsing player name resolve (CC-86)
parent
4a96b99619
commit
9467fc5699
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "opt-cc",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"author": "Florian Hartwich <hardi@noarch.de>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue