Fixed new player bug
This commit is contained in:
parent
622ecaf97c
commit
25cd90a1fb
5 changed files with 93 additions and 17 deletions
|
|
@ -50,7 +50,17 @@ class Match extends Model
|
|||
Log::info("Match::createMatchups( league_id=".$league->id.", numberOfrounds=".sizeof($rounds));
|
||||
$allPairings=Match::getAllPairings($league->id);
|
||||
|
||||
Log::info("Rounds:");
|
||||
$counter=1;
|
||||
foreach($rounds as $round) {
|
||||
Log::info($counter);
|
||||
Log::info($round."\n");
|
||||
$counter+=1;
|
||||
}
|
||||
|
||||
Log::info("League-id=".$league->id.", Size of allPairings:".sizeof($allPairings));
|
||||
foreach ($rounds as $round) {
|
||||
Log::info("Fetching roundNr/index=".$roundNr);
|
||||
$pairings = $allPairings[$roundNr];
|
||||
// Save pairings
|
||||
foreach($pairings as $pair) {
|
||||
|
|
@ -126,7 +136,7 @@ class Match extends Model
|
|||
public static function getAllPairings($leagueId) {
|
||||
$members = LeagueMember::getMembers($leagueId);
|
||||
|
||||
$roundCount=sizeof($members)-1;
|
||||
$roundCount=Match::getNumberOfNeededRounds($leagueId);
|
||||
|
||||
if (sizeof($members) % 2 == 1) { // ungerade memberzahl => freilos einfügen
|
||||
error_log("Adding -1 free entry");
|
||||
|
|
@ -148,8 +158,8 @@ class Match extends Model
|
|||
array_push($roundRobin, $userId);
|
||||
}
|
||||
|
||||
error_log("RoundNr ".$currentRoundNr." Array start:");
|
||||
error_log(implode(",",$roundRobin));
|
||||
//error_log("RoundNr ".$currentRoundNr." Array start:");
|
||||
//error_log(implode(",",$roundRobin));
|
||||
|
||||
$_roundNr = $currentRoundNr;
|
||||
while ($_roundNr >= 1) {
|
||||
|
|
@ -197,12 +207,12 @@ class Match extends Model
|
|||
|
||||
}
|
||||
|
||||
//foreach ($all as $roundNr => $pairings) {
|
||||
// foreach ($pairings as $slotIdx => $pairing) {
|
||||
// error_log($pairing[0]." vs ".$pairing[1]);
|
||||
// }
|
||||
// error_log("");
|
||||
//}
|
||||
foreach ($all as $roundNr => $pairings) {
|
||||
foreach ($pairings as $slotIdx => $pairing) {
|
||||
error_log($pairing[0]." vs ".$pairing[1]);
|
||||
}
|
||||
error_log("");
|
||||
}
|
||||
|
||||
return $all; // $all[$roundnr]= Array of Tuples ( UserId1, UserId2 )
|
||||
//return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue