show unplayed rounds
This commit is contained in:
parent
98ebdb6c93
commit
7545760aa2
5 changed files with 47 additions and 29 deletions
|
|
@ -94,7 +94,7 @@ class Match extends Model
|
|||
$match->round_name = $roundnames[$match->round_id];
|
||||
$match->user1_name = $usernames[$match->user1_id];
|
||||
$match->user2_name = $usernames[$match->user2_id];
|
||||
// Punktauswertung in Match::getResults($leagueId, $maxRoundId);
|
||||
// Punktauswertung in Match::getMatchResults($leagueId, $maxRoundId);
|
||||
}
|
||||
return $matches;
|
||||
}
|
||||
|
|
@ -156,34 +156,43 @@ class Match extends Model
|
|||
$roundtipps = Tipp::getRoundTipps($maxRoundId);
|
||||
$roundtipps = $roundtipps["roundtipps"];
|
||||
$matches = Match::getLeagueMatches($leagueId, $maxRoundId);
|
||||
$season = Season::getCurrent();
|
||||
|
||||
if ($maxRoundId==-1) {$maxRoundId=Round::getLastCompleteRoundId();}
|
||||
if ($maxRoundId==-1) { $maxRoundId = Round::getLastRoundId($season->id); }
|
||||
|
||||
foreach($matches as $key => $match) {
|
||||
if (!Round::isCompleted($match->round_id)) continue;
|
||||
|
||||
$user1_key = $match->round_id."_".$match->user1_id;
|
||||
$user2_key = $match->round_id."_".$match->user2_id;
|
||||
|
||||
$user1_score = $roundtipps[$user1_key]["rankscore"];
|
||||
$user2_score = $roundtipps[$user2_key]["rankscore"];
|
||||
if (Round::isCompleted($match->round_id)) {
|
||||
|
||||
$matches[$key]->user1_rankscore = $user1_score;
|
||||
$matches[$key]->user2_rankscore = $user2_score;
|
||||
$user1_score = $roundtipps[$user1_key]["rankscore"];
|
||||
$user2_score = $roundtipps[$user2_key]["rankscore"];
|
||||
|
||||
//$matches[$key]->user1_hits = $roundtipps[$user1_key][]
|
||||
$matches[$key]->user1_rankscore = $user1_score;
|
||||
$matches[$key]->user2_rankscore = $user2_score;
|
||||
|
||||
if ($user1_score > $user2_score) {
|
||||
$matches[$key]->user1_league_score = 3;
|
||||
$matches[$key]->user2_league_score = 0;
|
||||
//$matches[$key]->user1_hits = $roundtipps[$user1_key][]
|
||||
|
||||
}
|
||||
else if ($user1_score < $user2_score){
|
||||
if ($user1_score > $user2_score) {
|
||||
$matches[$key]->user1_league_score = 3;
|
||||
$matches[$key]->user2_league_score = 0;
|
||||
|
||||
}
|
||||
else if ($user1_score < $user2_score){
|
||||
$matches[$key]->user1_league_score = 0;
|
||||
$matches[$key]->user2_league_score = 3;
|
||||
} else {
|
||||
$matches[$key]->user1_league_score = 1;
|
||||
$matches[$key]->user2_league_score = 1;
|
||||
}
|
||||
|
||||
} else { // Untipped/future round
|
||||
$matches[$key]->user1_league_score = 0;
|
||||
$matches[$key]->user2_league_score = 3;
|
||||
} else {
|
||||
$matches[$key]->user1_league_score = 1;
|
||||
$matches[$key]->user2_league_score = 1;
|
||||
$matches[$key]->user2_league_score = 0;
|
||||
$matches[$key]->user1_rankscore = -1;
|
||||
$matches[$key]->user2_rankscore = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue