From: CMDR furrycat Date: Mon, 15 Feb 2016 08:25:53 +0000 (-0500) Subject: Sort by entry time. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=1c3c869a051620e2d9bf8b2f1a8771e2aff65cf7;p=furrycat%2Frace-o-matic.git Sort by entry time. --- diff --git a/lib/race.php b/lib/race.php index 2135a88..bc7e933 100644 --- a/lib/race.php +++ b/lib/race.php @@ -228,9 +228,12 @@ function show_entry($sort, $format, $entry, $allotted_time, $position, $rank, $ship_rank, $row, $type, $prize_name, $blue_count = 0, $white_count = 0) { $fields = array(); - if ($format == "full") $fields[] = $position; - $fields[] = $position ? $rank : ''; - $fields[] = $ship_rank; + if ($sort == "start_time") $fields[] = elite_time($entry->getStartTime()); + else { + if ($format == "full") $fields[] = $position; + $fields[] = $position ? $rank : ''; + $fields[] = $ship_rank; + } $fields[] = $entry->getEndorsementString(); $ship = $entry->getShip(); $competitor = $ship->getCompetitor(); @@ -710,7 +713,8 @@ 'best_speed' => 'ByBestSpeed', 'average_speed' => 'ByAverageSpeed', 'fastest_lap' => 'ByFastestLap', - 'average_lap' => 'ByAverageLap' + 'average_lap' => 'ByAverageLap', + 'start_time' => 'ByStartTime' ); $formats = array( 'prizes' => array(1, 'prizewinners'), @@ -803,8 +807,12 @@ $filtered_entries = array(); foreach (array('html', 'bbcode') as $type) { echo "
\n"; - $blue_fields = array('R', 'S', 'E', 'CMDR name', 'Forum name', 'Ship name', 'Ship type', 'Distance', 'Penalty'); - if ($format == "full") array_unshift($blue_fields, 'P'); + $blue_fields = array('E', 'CMDR name', 'Forum name', 'Ship name', 'Ship type', 'Distance', 'Penalty'); + if ($sort == "start_time") array_unshift($blue_fields, 'Start time'); + else { + if ($format == "full") array_unshift($blue_fields, 'P'); + array_unshift($blue_fields, 'R', 'S'); + } $white_fields = array('Lap distance', 'Laps'); if ($sort == 'penalty_distance') $white_fields[] = 'Total distance'; $white_fields = array_merge($white_fields, array('Allotted', 'Bonus', 'Raced', 'Total')); diff --git a/propel/build/classes/buckyball/Entry.php b/propel/build/classes/buckyball/Entry.php index 9138118..2af49aa 100644 --- a/propel/build/classes/buckyball/Entry.php +++ b/propel/build/classes/buckyball/Entry.php @@ -92,6 +92,10 @@ class Entry extends BaseEntry return self::Sort($a, $b, "getAverageLap"); } + function ByStartTime($a, $b) { + return self::Sort($a, $b, "getStartTime"); + } + /* Ordering by total distance then penalty time will classify racers appropriately in endurance races, while having no effect on dashes. diff --git a/propel/schema.xml b/propel/schema.xml index 2df0d04..c8bad27 100644 --- a/propel/schema.xml +++ b/propel/schema.xml @@ -201,6 +201,7 @@ +