Sort by entry time.
authorCMDR furrycat <elite@furrycat.net>
Mon, 15 Feb 2016 08:25:53 +0000 (03:25 -0500)
committerCMDR furrycat <elite@furrycat.net>
Mon, 15 Feb 2016 08:25:53 +0000 (03:25 -0500)
lib/race.php
propel/build/classes/buckyball/Entry.php
propel/schema.xml

index 2135a88..bc7e933 100644 (file)
 
   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();
       'best_speed' => 'ByBestSpeed',
       'average_speed' => 'ByAverageSpeed',
       'fastest_lap' => 'ByFastestLap',
-      'average_lap' => 'ByAverageLap'
+      'average_lap' => 'ByAverageLap',
+      'start_time' => 'ByStartTime'
     );
     $formats = array(
       'prizes' => array(1, 'prizewinners'),
       $filtered_entries = array();
       foreach (array('html', 'bbcode') as $type) {
         echo "<div class=\"$type\">\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'));
index 9138118..2af49aa 100644 (file)
@@ -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.
index 2df0d04..c8bad27 100644 (file)
     <column name="ship_id" type="integer" required="true"/>
     <column name="endorsements" type="integer" required="true"/>
     <column name="lap_distance" type="float" required="true"/>
+    <column name="start_time" type="timestamp" required="true"/>
     <column name="complete_laps" type="float" required="true"/>
     <column name="total_distance" type="float" required="true"/>
     <column name="penalty_time" type="integer"/>