From 79cadd2ec2e14a4cb0f36c828e34dd8351e8de89 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Tue, 26 Jan 2016 11:25:39 -0500 Subject: [PATCH] Competitors can't win multiple prizes. --- lib/race.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/race.php b/lib/race.php index 45307c4..2b4bf6e 100644 --- a/lib/race.php +++ b/lib/race.php @@ -281,12 +281,15 @@ 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; } } @@ -304,7 +307,11 @@ 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; } } -- 2.7.4