show unplayed rounds
This commit is contained in:
parent
98ebdb6c93
commit
7545760aa2
5 changed files with 47 additions and 29 deletions
|
|
@ -174,9 +174,9 @@ class LeaguesController extends Controller
|
||||||
public function showLeagueRounds($league_rank, $maxRoundId) {
|
public function showLeagueRounds($league_rank, $maxRoundId) {
|
||||||
if (Auth::guest()) { return redirect("/"); }
|
if (Auth::guest()) { return redirect("/"); }
|
||||||
|
|
||||||
$maxRoundId = min(Round::getLastCompleteRoundId(),$maxRoundId);
|
|
||||||
|
|
||||||
$season=Season::getCurrent();
|
$season=Season::getCurrent();
|
||||||
|
$maxRoundId = min(Round::getLastRoundId($season->id),$maxRoundId);
|
||||||
|
|
||||||
$roundNames = Round::getNames();
|
$roundNames = Round::getNames();
|
||||||
$leagueNames = League::getNames();
|
$leagueNames = League::getNames();
|
||||||
$leagues = League::where('season_id','=',$season->id)->where('rank','=', $league_rank)->orderBy('id')->get();
|
$leagues = League::where('season_id','=',$season->id)->where('rank','=', $league_rank)->orderBy('id')->get();
|
||||||
|
|
@ -198,7 +198,6 @@ class LeaguesController extends Controller
|
||||||
$matchesTotal[$match->round_id][$league->id] = $lg;
|
$matchesTotal[$match->round_id][$league->id] = $lg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames'));
|
return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames'));
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,6 @@ class Round extends Model
|
||||||
return $tippSpielLink;
|
return $tippSpielLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ab sofort Verzicht auf statische Methoden, soweit möglich.
|
// Ab sofort Verzicht auf statische Methoden, soweit möglich.
|
||||||
|
|
||||||
public function getLockTime() {
|
public function getLockTime() {
|
||||||
|
|
@ -153,4 +152,10 @@ class Round extends Model
|
||||||
}
|
}
|
||||||
return $roundnames;
|
return $roundnames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getLastRoundId($seasonId) {
|
||||||
|
$round = Round::where('season_id', '=', $seasonId)->orderBy('id','desc')->first(); // get last entry
|
||||||
|
return $round->id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,13 +88,14 @@ class League extends Model
|
||||||
|
|
||||||
$matches=Match::getMatchResults($league->id,-1);
|
$matches=Match::getMatchResults($league->id,-1);
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
if (!Round::isCompleted($match->round_id)) { continue; }
|
if (Round::isCompleted($match->round_id)) {
|
||||||
$memberScores[$match->user1_id][1] += $match->user1_league_score;
|
$memberScores[$match->user1_id][1] += $match->user1_league_score;
|
||||||
$memberScores[$match->user1_id][2] += $match->user1_rankscore;
|
$memberScores[$match->user1_id][2] += $match->user1_rankscore;
|
||||||
$memberScores[$match->user1_id][3] += $match->user2_rankscore;
|
$memberScores[$match->user1_id][3] += $match->user2_rankscore;
|
||||||
$memberScores[$match->user2_id][1] += $match->user2_league_score;
|
$memberScores[$match->user2_id][1] += $match->user2_league_score;
|
||||||
$memberScores[$match->user2_id][2] += $match->user2_rankscore;
|
$memberScores[$match->user2_id][2] += $match->user2_rankscore;
|
||||||
$memberScores[$match->user2_id][3] += $match->user1_rankscore;
|
$memberScores[$match->user2_id][3] += $match->user1_rankscore;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
usort($memberScores, array('App\Leagues\League','cmpScore'));
|
usort($memberScores, array('App\Leagues\League','cmpScore'));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class Match extends Model
|
||||||
$match->round_name = $roundnames[$match->round_id];
|
$match->round_name = $roundnames[$match->round_id];
|
||||||
$match->user1_name = $usernames[$match->user1_id];
|
$match->user1_name = $usernames[$match->user1_id];
|
||||||
$match->user2_name = $usernames[$match->user2_id];
|
$match->user2_name = $usernames[$match->user2_id];
|
||||||
// Punktauswertung in Match::getResults($leagueId, $maxRoundId);
|
// Punktauswertung in Match::getMatchResults($leagueId, $maxRoundId);
|
||||||
}
|
}
|
||||||
return $matches;
|
return $matches;
|
||||||
}
|
}
|
||||||
|
|
@ -156,34 +156,43 @@ class Match extends Model
|
||||||
$roundtipps = Tipp::getRoundTipps($maxRoundId);
|
$roundtipps = Tipp::getRoundTipps($maxRoundId);
|
||||||
$roundtipps = $roundtipps["roundtipps"];
|
$roundtipps = $roundtipps["roundtipps"];
|
||||||
$matches = Match::getLeagueMatches($leagueId, $maxRoundId);
|
$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) {
|
foreach($matches as $key => $match) {
|
||||||
if (!Round::isCompleted($match->round_id)) continue;
|
|
||||||
|
|
||||||
$user1_key = $match->round_id."_".$match->user1_id;
|
$user1_key = $match->round_id."_".$match->user1_id;
|
||||||
$user2_key = $match->round_id."_".$match->user2_id;
|
$user2_key = $match->round_id."_".$match->user2_id;
|
||||||
|
|
||||||
$user1_score = $roundtipps[$user1_key]["rankscore"];
|
if (Round::isCompleted($match->round_id)) {
|
||||||
$user2_score = $roundtipps[$user2_key]["rankscore"];
|
|
||||||
|
|
||||||
$matches[$key]->user1_rankscore = $user1_score;
|
$user1_score = $roundtipps[$user1_key]["rankscore"];
|
||||||
$matches[$key]->user2_rankscore = $user2_score;
|
$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_hits = $roundtipps[$user1_key][]
|
||||||
$matches[$key]->user1_league_score = 3;
|
|
||||||
$matches[$key]->user2_league_score = 0;
|
|
||||||
|
|
||||||
}
|
if ($user1_score > $user2_score) {
|
||||||
else 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]->user1_league_score = 0;
|
||||||
$matches[$key]->user2_league_score = 3;
|
$matches[$key]->user2_league_score = 0;
|
||||||
} else {
|
$matches[$key]->user1_rankscore = -1;
|
||||||
$matches[$key]->user1_league_score = 1;
|
$matches[$key]->user2_rankscore = -1;
|
||||||
$matches[$key]->user2_league_score = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,11 @@
|
||||||
<tr class="table-bordered">
|
<tr class="table-bordered">
|
||||||
<td> {{$match->user1_name}} </td>
|
<td> {{$match->user1_name}} </td>
|
||||||
<td> {{$match->user2_name}} </td>
|
<td> {{$match->user2_name}} </td>
|
||||||
<td> {{$match->user1_rankscore}}:{{$match->user2_rankscore}}</td>
|
@if($match->user1_rankscore==-1)
|
||||||
|
<td> ausstehend </td>
|
||||||
|
@else
|
||||||
|
<td> {{$match->user1_rankscore}}:{{$match->user2_rankscore}}</td>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue