diff --git a/js/queries.js b/js/queries.js index 41cba7d..c512409 100644 --- a/js/queries.js +++ b/js/queries.js @@ -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; + } + }; diff --git a/js/util.js b/js/util.js index 3deaf50..a9b3555 100644 --- a/js/util.js +++ b/js/util.js @@ -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