2017-12-08 13:37:04 +01:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var processor = {
|
|
|
|
|
|
|
|
getRace: function(raceId) {
|
|
|
|
var race = {
|
|
|
|
drivers: null,
|
|
|
|
lapTimes: null,
|
|
|
|
pitStops: null,
|
|
|
|
qualifying: null,
|
2017-12-08 13:50:59 +01:00
|
|
|
results: null,
|
|
|
|
raceInfo: null
|
2017-12-08 13:37:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
race.drivers = queries.getDriversByRaceId(raceId);
|
|
|
|
race.lapTimes = queries.getLapDataByRaceId(raceId);
|
|
|
|
race.qualifying = queries.getQualifingDataByRaceId(raceId);
|
|
|
|
race.pitStops = queries.getPitStopsByRaceId(raceId);
|
|
|
|
race.results = queries.getResultsByRaceId(raceId);
|
2017-12-08 13:50:59 +01:00
|
|
|
race.raceInfo = queries.getRaceById(raceId);
|
2017-12-08 13:37:04 +01:00
|
|
|
|
|
|
|
return race;
|
|
|
|
},
|
2017-12-08 13:50:59 +01:00
|
|
|
|
|
|
|
getRacesByYear: function(year) {
|
|
|
|
var races = queries.getRacesByYear(year);
|
|
|
|
return races.map(race => processor.getRace(race.raceId));
|
|
|
|
}
|
2017-12-08 13:37:04 +01:00
|
|
|
};
|