diff --git a/js/util.js b/js/util.js index f85a02d..ebd742f 100644 --- a/js/util.js +++ b/js/util.js @@ -202,6 +202,7 @@ function renderDriverInfoBox(race) { content += ""; content += ""; content += "Rank"; + content += "Position"; content += "Code"; content += "Points"; content += "Fastest Lap Speed"; @@ -218,16 +219,18 @@ function renderDriverInfoBox(race) { content += ""; for(var di in drivers) { var driver = drivers[di]; - // Replace NaN with something proper - if(isNaN(driver.position)) { - driver.position = "-/-"; - } + // Replace NaN position with something proper + driver.sortablePosition = driver.position; + if(isNaN(driver.sortablePosition)) driver.sortablePosition = 999; + if(isNaN(driver.position)) driver.position = "-/-"; + // Make ranks sortable, treat zero rank as very bad for sorting driver.sortableRank = driver.rank; if(driver.sortableRank < 1) driver.sortableRank = 999; if(isNaN(driver.fastestLapSpeed)) driver.fastestLapSpeed = 0; //console.log(driver); content += ""; content += ""+driver.rank+""; + content += ""+driver.position+""; content += ""+driver.code+""; content += ""+driver.points+""; content += ""+driver.fastestLapSpeed+"";