Competitors can't win multiple prizes.
authorCMDR furrycat <elite@furrycat.net>
Tue, 26 Jan 2016 16:25:39 +0000 (11:25 -0500)
committerCMDR furrycat <elite@furrycat.net>
Tue, 26 Jan 2016 16:25:39 +0000 (11:25 -0500)
lib/race.php

index 45307c4..2b4bf6e 100644 (file)
       if ($entry->isExcluded()) continue;
       $entry_id = $entry->getId();
       if (in_array($entry_id, array_values($ret))) continue;
-      $competitor_id = $entry->getShip()->getCompetitor()->getId();
+      $competitor_id = $entry->getShip()->getCompetitorId();
       if (in_array($competitor_id, $competitors)) continue;
-      $competitors[] = $competitor_id;
-      if (is_null($ret['leader'])) $ret['leader'] = $entry_id;
+      if (is_null($ret['leader'])) {
+        $ret['leader'] = $entry_id;
+        $competitors[] = $competitor_id;
+      }
       else if (is_null($ret['runnerup'])) {
         $ret['runnerup'] = $entry_id;
+        $competitors[] = $competitor_id;
         break;
       }
     }
         if ($entry->isExcluded()) continue;
         $entry_id = $entry->getId();
         if (in_array($entry_id, array_values($ret))) continue;
+        $competitor_id = $entry->getShip()->getCompetitorId();
+        if (in_array($competitor_id, $competitors)) continue;
         $ret[$key] = $entry_id;
+        $competitors[] = $competitor_id;
+        break;
       }
     }