WIP. Adding function to get the lap data by race id
This commit is contained in:
parent
29f3184f31
commit
5a8ca5e687
|
@ -37,4 +37,21 @@ var queries = {
|
|||
return dataset;
|
||||
},
|
||||
|
||||
/*
|
||||
* TODO
|
||||
*/
|
||||
getLapDataByRaceID: function(raceid) {
|
||||
var rawData = preprocessor.getResults();
|
||||
var raceID = raceid;
|
||||
var lapTimes = rawData['lapTimes'].filter((val) => {return val['raceId'] == raceID;});
|
||||
var groupedLapTimes = {};
|
||||
lapTimes.forEach(function(d,i) {
|
||||
var lapNum = d["lap"];
|
||||
var driverId = d["driverId"];
|
||||
if(groupedLapTimes[lapNum] === undefined) groupedLapTimes[lapNum] = {};
|
||||
groupedLapTimes[lapNum][driverId] = d["milliseconds"];
|
||||
});
|
||||
return groupedLapTimes;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@ var loadingDialog = {
|
|||
progressItemsDone: 0,
|
||||
// Initialize+Show the loading dialog with a number of items to progress
|
||||
show: function(progressItems = 1) {
|
||||
console.log("show");
|
||||
this.progressItems = progressItems;
|
||||
this.progressItemsDone = 0;
|
||||
this._updateProgressBar();
|
||||
|
@ -19,11 +20,13 @@ var loadingDialog = {
|
|||
},
|
||||
// Function to signal that another item was progressed
|
||||
itemFinished: function() {
|
||||
|
||||
this.progressItemsDone++;
|
||||
this._updateProgressBar();
|
||||
},
|
||||
// Hide the dialog
|
||||
hide: function() {
|
||||
console.log("hide");
|
||||
$(this.id).modal('hide');
|
||||
},
|
||||
// Private function to update the progress bar shown
|
||||
|
|
Loading…
Reference in New Issue