Merge branch 'master' into Init_Diagram

This commit is contained in:
Flo 2017-12-11 01:33:34 +01:00 committed by GitHub
commit b6004895ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 12 deletions

View File

@ -22,18 +22,12 @@
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(aktuelle Seite)</span></a> <a class="nav-link" href="#">Home <span class="sr-only">(aktuelle Seite)</span></a>
</li> </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"> <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"> <div class="dropdown-menu" aria-labelledby="dropdown01">
<a class="dropdown-item" href="#">... gibt es ...</a> <a class="dropdown-item" href="#">Einrückungen mit zwei Leerzeichen</a>
<a class="dropdown-item" href="#">... auch so tolle ...</a> <a class="dropdown-item" href="#">Charset ist UTF-8</a>
<a class="dropdown-item" href="#">... Menüpunkte!</a> <a class="dropdown-item" href="#">Keine Panik!</a>
</div> </div>
</li> </li>
</ul> </ul>
@ -43,6 +37,18 @@
<main role="main" class="container"> <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"> <div class="content-box">
<h1>Rennen, Brumm, Brumm!</h1> <h1>Rennen, Brumm, Brumm!</h1>
<p class="lead"> <p class="lead">

View File

@ -5,7 +5,10 @@
*/ */
preprocessor.load(function(data) { 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)); createLineGraph("#lineGraphBox", processor.getRace(1));
}); });

View File

@ -8,7 +8,8 @@ var processor = {
lapTimes: null, lapTimes: null,
pitStops: null, pitStops: null,
qualifying: null, qualifying: null,
results: null results: null,
raceInfo: null
}; };
race.drivers = queries.getDriversByRaceId(raceId); race.drivers = queries.getDriversByRaceId(raceId);
@ -16,7 +17,13 @@ var processor = {
race.qualifying = queries.getQualifingDataByRaceId(raceId); race.qualifying = queries.getQualifingDataByRaceId(raceId);
race.pitStops = queries.getPitStopsByRaceId(raceId); race.pitStops = queries.getPitStopsByRaceId(raceId);
race.results = queries.getResultsByRaceId(raceId); race.results = queries.getResultsByRaceId(raceId);
race.raceInfo = queries.getRaceById(raceId);
return race; return race;
}, },
getRacesByYear: function(year) {
var races = queries.getRacesByYear(year);
return races.map(race => processor.getRace(race.raceId));
}
}; };

View File

@ -109,6 +109,26 @@ var queries = {
return myMap; 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) { getQualifingDataByRaceId: function(raceId) {
var rawData = preprocessor.getResults(); var rawData = preprocessor.getResults();