diff --git a/api/models/logs/vehicle.js b/api/models/logs/vehicle.js index 704d96e..e360e00 100644 --- a/api/models/logs/vehicle.js +++ b/api/models/logs/vehicle.js @@ -16,6 +16,9 @@ const LogVehicleKillSchema = new Schema({ shooter: { type: String, }, + additionalShooter: { + type: [String], + }, target: { type: String, required: true, diff --git a/api/tools/log-parse-tool.js b/api/tools/log-parse-tool.js index 0a9d3dc..d24bb85 100644 --- a/api/tools/log-parse-tool.js +++ b/api/tools/log-parse-tool.js @@ -80,14 +80,21 @@ const parseWarLog = (lineArray, war) => { const targetString = line.substring(line.lastIndexOf(' --- Fahrzeug: ') + 15, line.lastIndexOf(' von:')); const target = getVehicleAndFractionFromString(targetString); if (target && shooter && target.fraction !== shooter.fraction) { - stats.vehicles.push({ + const vehicleKill = { war: war._id, time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]), - shooter: shooter ? shooter.name : null, target: target ? target.name : null, fraction: shooter ? shooter.fraction : 'NONE', vehicleClass: target.vehicleClass, - }); + }; + if (shooter && shooter.name instanceof Array) { + vehicleKill.shooter = shooter.name[0]; + vehicleKill.additionalShooter = shooter.name.slice(1, shooter.name.length); + } else { + vehicleKill.shooter = shooter ? shooter.name : null + } + console.log(vehicleKill) + stats.vehicles.push(vehicleKill); } } else { const targetString = line.substring(line.lastIndexOf(' --- Einheit: ') + 14, line.lastIndexOf(' von:'));