Skip to content

Commit

Permalink
Better implementation of league stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Jan 10, 2024
1 parent e4b1060 commit 1e3a20f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions gatherling/models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,11 @@ public function isLeague()
return false;
}

public function leagueLength()
{
return 6; // TODO: This should be customizable.
}

// All this should probably go somewhere else
// Pairs the round which is currently running.
// This should probably be in Standings?
Expand Down
4 changes: 2 additions & 2 deletions gatherling/models/Standings.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function getOpponents($eventname, $subevent, $round)
*
* @return void|array
*/
public function League_getAvailable_Opponents($subevent, $round)
public function League_getAvailable_Opponents($subevent, $round, $league_length)
{
$opponentsAlreadyFaced = [];
$allPlayers = [];
Expand Down Expand Up @@ -310,7 +310,7 @@ public function League_getAvailable_Opponents($subevent, $round)
if ($structure == 'League Match' && count($opponentsAlreadyFaced) >= 1) {
return [];
}
if (count($opponentsAlreadyFaced) >= 5) {
if (count($opponentsAlreadyFaced) >= $league_length) {
return [];
}
// Get all opponents who haven't dropped from event and exclude myself
Expand Down
2 changes: 1 addition & 1 deletion gatherling/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ function print_ActiveEvents()
echo '<td>'.$entry->createDeckLink().'</td>';
} elseif ($structure == 'League') {
$count = $event->getPlayerLeagueMatchCount($player->name) + 1;
if ($count < 7) {
if ($count <= $event->leagueLength()) {
$Leagues[] = "<tr><td>{$event->name} Match: {$count}</td><td><a href=\"report.php?mode=submit_league_result&event={$event->name}&round={$event->current_round}&subevent={$subevent_id}\">Report League Game</a></td></tr>";
}
} elseif ($structure == 'League Match') {
Expand Down

0 comments on commit 1e3a20f

Please sign in to comment.