Working on Case2: New League Creation after Qualification

This commit is contained in:
Torsten 2017-11-02 16:41:07 +01:00
parent d8a7f78cbd
commit 66671b1e81
11 changed files with 12726 additions and 40 deletions

View file

@ -2,11 +2,13 @@
namespace App;
use Carbon;
use Illuminate\Database\Eloquent\Model;
class Test extends Model
{
// In order for testing seasons to work, we need a way to set all the users to 'paid'
// this method is used by fillSeason method
public static function paySeason($seasonId)
{
$users = User::all();
@ -18,12 +20,18 @@ class Test extends Model
return $cnt." Users in season_id ".$seasonId." set to paid";
}
public static function fillSeason($seasonId) {
public static function fillSeason($seasonId=-1) {
error_log("creating all tipps started");
Tipp::createAllTips();
error_log("creating all tipps completed");
$users = User::all();
if ($seasonId==-1) {
$season = Season::getCurrent();
$seasonId = $season->id;
}
error_log("setting payment started");
Test::paySeason($seasonId);
error_log("setting payment completed");
@ -41,6 +49,7 @@ class Test extends Model
foreach ($games as $game) {
$game->score1=random_int(0,3);
$game->score2=random_int(0,3);
$game->kickoff= Carbon\Carbon::now();
$game->save();
foreach ($users as $user) {
// Tipps faken