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;
|
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,
|
progressItemsDone: 0,
|
||||||
// Initialize+Show the loading dialog with a number of items to progress
|
// Initialize+Show the loading dialog with a number of items to progress
|
||||||
show: function(progressItems = 1) {
|
show: function(progressItems = 1) {
|
||||||
|
console.log("show");
|
||||||
this.progressItems = progressItems;
|
this.progressItems = progressItems;
|
||||||
this.progressItemsDone = 0;
|
this.progressItemsDone = 0;
|
||||||
this._updateProgressBar();
|
this._updateProgressBar();
|
||||||
@ -19,11 +20,13 @@ var loadingDialog = {
|
|||||||
},
|
},
|
||||||
// Function to signal that another item was progressed
|
// Function to signal that another item was progressed
|
||||||
itemFinished: function() {
|
itemFinished: function() {
|
||||||
|
|
||||||
this.progressItemsDone++;
|
this.progressItemsDone++;
|
||||||
this._updateProgressBar();
|
this._updateProgressBar();
|
||||||
},
|
},
|
||||||
// Hide the dialog
|
// Hide the dialog
|
||||||
hide: function() {
|
hide: function() {
|
||||||
|
console.log("hide");
|
||||||
$(this.id).modal('hide');
|
$(this.id).modal('hide');
|
||||||
},
|
},
|
||||||
// Private function to update the progress bar shown
|
// Private function to update the progress bar shown
|
||||||
|
Loading…
Reference in New Issue
Block a user