Merge branch 'master' into Init_Diagram
This commit is contained in:
commit
b6004895ee
26
index.html
26
index.html
|
@ -22,18 +22,12 @@
|
|||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#">Home <span class="sr-only">(aktuelle Seite)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Irgendetwas anderes</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#">TODO ...</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Hier ...</a>
|
||||
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Coding-Guidlines!</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdown01">
|
||||
<a class="dropdown-item" href="#">... gibt es ...</a>
|
||||
<a class="dropdown-item" href="#">... auch so tolle ...</a>
|
||||
<a class="dropdown-item" href="#">... Menüpunkte!</a>
|
||||
<a class="dropdown-item" href="#">Einrückungen mit zwei Leerzeichen</a>
|
||||
<a class="dropdown-item" href="#">Charset ist UTF-8</a>
|
||||
<a class="dropdown-item" href="#">Keine Panik!</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -43,6 +37,18 @@
|
|||
|
||||
<main role="main" class="container">
|
||||
|
||||
<div class="container">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="seasonByYearSelector">Wähle ein Jahr aus!</label>
|
||||
<select class="form-control" id="seasonByYearSelector">
|
||||
<!-- This is filled using JS. -->
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content-box">
|
||||
<h1>Rennen, Brumm, Brumm!</h1>
|
||||
<p class="lead">
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
*/
|
||||
|
||||
preprocessor.load(function(data) {
|
||||
// Some sample code for a year selector - TODO: Improve a lot and move somewhere else
|
||||
var yearSelector = $("#seasonByYearSelector");
|
||||
var seasons = preprocessor.getResults().seasons;
|
||||
for(var year in seasons) yearSelector.append("<option>" + year + "</option>");
|
||||
|
||||
createLineGraph("#lineGraphBox", processor.getRace(1));
|
||||
|
||||
});
|
||||
|
|
|
@ -8,7 +8,8 @@ var processor = {
|
|||
lapTimes: null,
|
||||
pitStops: null,
|
||||
qualifying: null,
|
||||
results: null
|
||||
results: null,
|
||||
raceInfo: null
|
||||
};
|
||||
|
||||
race.drivers = queries.getDriversByRaceId(raceId);
|
||||
|
@ -16,7 +17,13 @@ var processor = {
|
|||
race.qualifying = queries.getQualifingDataByRaceId(raceId);
|
||||
race.pitStops = queries.getPitStopsByRaceId(raceId);
|
||||
race.results = queries.getResultsByRaceId(raceId);
|
||||
race.raceInfo = queries.getRaceById(raceId);
|
||||
|
||||
return race;
|
||||
},
|
||||
|
||||
getRacesByYear: function(year) {
|
||||
var races = queries.getRacesByYear(year);
|
||||
return races.map(race => processor.getRace(race.raceId));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -109,6 +109,26 @@ var queries = {
|
|||
return myMap;
|
||||
},
|
||||
|
||||
getRaceById: function(raceId){
|
||||
var rawData = preprocessor.getResults();
|
||||
return rawData.races[raceId];
|
||||
},
|
||||
|
||||
getRacesByYear: function(year){
|
||||
var rawData = preprocessor.getResults();
|
||||
|
||||
var races = [];
|
||||
for(var key in rawData.races){
|
||||
if(rawData.races[key].year == year){
|
||||
races.push(rawData.races[key]);
|
||||
}
|
||||
}
|
||||
races.sort((o1,o2) => o1["round"] - o2["round"]);
|
||||
|
||||
return races;
|
||||
|
||||
},
|
||||
|
||||
getQualifingDataByRaceId: function(raceId) {
|
||||
var rawData = preprocessor.getResults();
|
||||
|
||||
|
|
Loading…
Reference in New Issue