From: CMDR furrycat Date: Fri, 22 Jan 2016 10:44:36 +0000 (-0500) Subject: One prize per competitor. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=c9781cf5e519f2783cb73a6d60c423fd7417b5a3;p=furrycat%2Frace-o-matic.git One prize per competitor. --- diff --git a/lib/race.php b/lib/race.php index e97b4fe..750c8fc 100644 --- a/lib/race.php +++ b/lib/race.php @@ -271,11 +271,16 @@ $sorted ); + $competitors = array(); + /* Leader and runner-up. */ foreach ($entries as $entry) { if (endorsement('x', $entry->getEndorsements())) continue; $entry_id = $entry->getId(); if (in_array($entry_id, array_values($ret))) continue; + $competitor_id = $entry->getShip()->getCompetitor()->getId(); + if (in_array($competitor_id, $competitors)) continue; + $competitors[] = $competitor_id; if (is_null($ret['leader'])) $ret['leader'] = $entry_id; else if (is_null($ret['runnerup'])) { $ret['runnerup'] = $entry_id;