Save additional shopoters for vehicle kill
parent
d10fc8e49a
commit
fc5eaf868a
|
@ -16,6 +16,9 @@ const LogVehicleKillSchema = new Schema({
|
||||||
shooter: {
|
shooter: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
additionalShooter: {
|
||||||
|
type: [String],
|
||||||
|
},
|
||||||
target: {
|
target: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
@ -80,14 +80,21 @@ const parseWarLog = (lineArray, war) => {
|
||||||
const targetString = line.substring(line.lastIndexOf(' --- Fahrzeug: ') + 15, line.lastIndexOf(' von:'));
|
const targetString = line.substring(line.lastIndexOf(' --- Fahrzeug: ') + 15, line.lastIndexOf(' von:'));
|
||||||
const target = getVehicleAndFractionFromString(targetString);
|
const target = getVehicleAndFractionFromString(targetString);
|
||||||
if (target && shooter && target.fraction !== shooter.fraction) {
|
if (target && shooter && target.fraction !== shooter.fraction) {
|
||||||
stats.vehicles.push({
|
const vehicleKill = {
|
||||||
war: war._id,
|
war: war._id,
|
||||||
time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]),
|
time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]),
|
||||||
shooter: shooter ? shooter.name : null,
|
|
||||||
target: target ? target.name : null,
|
target: target ? target.name : null,
|
||||||
fraction: shooter ? shooter.fraction : 'NONE',
|
fraction: shooter ? shooter.fraction : 'NONE',
|
||||||
vehicleClass: target.vehicleClass,
|
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 {
|
} else {
|
||||||
const targetString = line.substring(line.lastIndexOf(' --- Einheit: ') + 14, line.lastIndexOf(' von:'));
|
const targetString = line.substring(line.lastIndexOf(' --- Einheit: ') + 14, line.lastIndexOf(' von:'));
|
||||||
|
|
Loading…
Reference in New Issue