Add new transport parsing to stats upload

pull/24/head
HardiReady 2018-02-01 07:06:26 +01:00
parent 8ae4999593
commit c6b9858420
1 changed files with 20 additions and 20 deletions

View File

@ -140,26 +140,26 @@ const parseWarLog = (lineArray, war) => {
});
}
// /**
// * TRANSPORT
// */
// else if (line.includes('Transport ||')) {
// stats.clean.push(line);
// const driverString = line.substring(line.lastIndexOf('wurde von ') + 10, line.lastIndexOf(' eingeflogen'));
// const driver = getPlayerAndFractionFromString(driverString);
// const passengerString = line.substring(line.lastIndexOf('|| ') + 3, line.lastIndexOf(' wurde von'));
// const passenger = getPlayerAndFractionFromString(passengerString);
// const distance = parseInt(line.substring(line.lastIndexOf('eingeflogen (') + 13, line.lastIndexOf('m)') - 1));
//
// stats.transport.push({
// war: war._id,
// time: getFullTimeDate(war.date, line.split(' ')[5]),
// driver: driver.name,
// passenger: passenger ? passenger.name : null,
// fraction: driver.fraction,
// distance: distance
// });
// }
/**
* TRANSPORT
*/
else if (line.includes('(Transport)')) {
stats.clean.push(line);
const driverString = line.substring(line.lastIndexOf('wurde von ') + 10, line.lastIndexOf(' eingeflogen'));
const driver = getPlayerAndFractionFromString(driverString);
const passengerString = line.substring(line.lastIndexOf('--- ') + 3, line.lastIndexOf(' wurde von'));
const passenger = getPlayerAndFractionFromString(passengerString);
const distance = parseInt(line.substring(line.lastIndexOf('eingeflogen (') + 13, line.lastIndexOf('m)') - 1));
stats.transport.push({
war: war._id,
time: getFullTimeDate(war.date, line.split(' ')[5]),
driver: driver.name,
passenger: passenger ? passenger.name : null,
fraction: driver.fraction,
distance: distance
});
}
/**
* PLAYERS