Tipps und Ranglisten erste Basic Version
This commit is contained in:
parent
7a33f5f889
commit
12651fc2e8
6 changed files with 99 additions and 9 deletions
|
|
@ -6,6 +6,9 @@ use Illuminate\Notifications\Notifiable;
|
|||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use App\Season;
|
||||
use App\Payment;
|
||||
use App\Round;
|
||||
use App\Game;
|
||||
use Log;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
|
|
@ -61,4 +64,32 @@ class User extends Authenticatable
|
|||
return null;
|
||||
}
|
||||
|
||||
public static function getScore($user_id) {
|
||||
|
||||
Log::info("User::getScore for userid=" . $user_id);
|
||||
|
||||
$season = Season::getCurrent();
|
||||
|
||||
$rounds = Round::where('season_id','=',$season->id)->get();
|
||||
|
||||
$totalScore=0;
|
||||
foreach($rounds as $round) {
|
||||
$games = Game::where('round_id','=',$round->id)->get();
|
||||
Log::info(' round_id=' . $round->id);
|
||||
foreach ($games as $game) {
|
||||
|
||||
Log::info(' game_id=' . $game->id);
|
||||
|
||||
$tipp = Tipp::getTipp($game->id,$user_id);
|
||||
$score = Tipp::getScore($tipp->id);
|
||||
|
||||
Log::info(" Game id=" . $game->id. ", Tipp id=". $tipp->id.", score=" . $score);
|
||||
|
||||
$totalScore+=$score;
|
||||
}
|
||||
}
|
||||
Log::info("Total score=" . $totalScore);
|
||||
return $totalScore;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue