Added the result to the enhanced lap data
This commit is contained in:
parent
20d3bdd1fb
commit
c4037f95e9
|
@ -34,14 +34,24 @@ getEnhancedLapDataPerDriver: function(raceData) {
|
||||||
//Attach Qualifying Data
|
//Attach Qualifying Data
|
||||||
lapData.qualifying = processor.getQualifyingForDriver(raceData, driver);
|
lapData.qualifying = processor.getQualifyingForDriver(raceData, driver);
|
||||||
//add Qualifying Data to the Laps
|
//add Qualifying Data to the Laps
|
||||||
lapData.laps.push({'driverId': driver.driverId, 'lap': 0, 'position': lapData.qualifying.position})
|
var lap0 = {'driverId': driver.driverId, 'lap': 0, 'position': lapData.qualifying.position};
|
||||||
|
var endResult = raceData.results.filter(res => res.driverId == driver.driverId && res.laps == 0);
|
||||||
|
if(endResult.length > 0){
|
||||||
|
lap0.finished = endResult[0];
|
||||||
|
}
|
||||||
|
lapData.laps.push(lap0);
|
||||||
raceData.lapTimes.forEach(lap => {
|
raceData.lapTimes.forEach(lap => {
|
||||||
lap.forEach(curLap => {
|
lap.forEach(curLap => {
|
||||||
if( curLap.driverId == driver.driverId ){
|
if( curLap.driverId == driver.driverId ){
|
||||||
var pitstop = raceData.pitStops.filter(pitstop => pitstop.driverId == driver.driverId && pitstop.lap == curLap.lap);
|
var pitstop = raceData.pitStops.filter(pitstop => pitstop.driverId == driver.driverId && pitstop.lap == curLap.lap);
|
||||||
|
var endResult = raceData.results.filter(res => res.driverId == driver.driverId && res.laps == curLap.lap);
|
||||||
if(pitstop.length > 0){
|
if(pitstop.length > 0){
|
||||||
curLap.pitStop = pitstop[0];
|
curLap.pitStop = pitstop[0];
|
||||||
}
|
}
|
||||||
|
if(endResult.length > 0){
|
||||||
|
curLap.finished = endResult[0];
|
||||||
|
}
|
||||||
|
|
||||||
lapData.laps.push(curLap);
|
lapData.laps.push(curLap);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
python -m http.server
|
Loading…
Reference in New Issue