Tippstart auf Tippable round, Link Roundmail: Tipps@Tippspiel
This commit is contained in:
parent
0abaeb2eba
commit
6aad1a7ab2
13 changed files with 149 additions and 34 deletions
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Roundmail;
|
||||
use App\User;
|
||||
use App\Round;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Mail\RoundmailMailer;
|
||||
|
|
@ -98,7 +99,7 @@ class RoundmailController extends Controller
|
|||
$missingJokerMailList = implode(",",$missingJokerMailList);
|
||||
$adminMailList = implode(",",$adminMailList);
|
||||
|
||||
|
||||
$tippSpielLink="http://hoschis-tippspiel.de/tipps#".Round::getFirstTippableRound()->id;
|
||||
|
||||
$topic="";
|
||||
$mail_message="";
|
||||
|
|
@ -118,7 +119,7 @@ class RoundmailController extends Controller
|
|||
|
||||
|
||||
|
||||
return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode'));
|
||||
return view('roundmails.show',compact('mail_id','activeMailList','inactiveMailList','missingTippMailList','missingJokerMailList','adminMailList','send_date','user_id','topic', 'mail_message', 'recipients', 'sender_name','viewmode','tippSpielLink'));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -189,4 +190,7 @@ class RoundmailController extends Controller
|
|||
|
||||
}
|
||||
|
||||
public function checkReminder() {
|
||||
Log::info("RoundmailController::checkReminder was triggered");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ class TippsController extends Controller
|
|||
|
||||
$rounds = Round::all()->where('season_id', '=', $activeSeason->id);
|
||||
foreach($rounds as $round) {
|
||||
|
||||
$games=Game::all()->where('round_id','=',$round->id);
|
||||
foreach($games as $game) {
|
||||
|
||||
|
|
@ -74,14 +73,9 @@ class TippsController extends Controller
|
|||
|
||||
TippsController::createTipps($user->id); // ggfs. fehlender Tipp Eintraege einfügen
|
||||
|
||||
$lastLockedRoundId=Round::getLastLockedRoundId();
|
||||
|
||||
if ($activeSeason) {
|
||||
$activeSeasonId = Season::getCurrent()->id;
|
||||
$rounds = Round::all()->where('season_id', '=', $activeSeasonId);
|
||||
}
|
||||
|
||||
|
||||
Log::info("REDIRECTING to TIPPS index");
|
||||
$rounds = Round::where('season_id', '=', $activeSeason->id)->get();
|
||||
|
||||
return view('tipps.index', compact('rounds', 'activeSeason', 'user'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ use Illuminate\Contracts\Auth\Guard;
|
|||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Illuminate\Auth\Passwords\PasswordBroker;
|
||||
|
||||
|
||||
|
||||
use DB;
|
||||
use Auth;
|
||||
use Log;
|
||||
|
|
@ -53,8 +51,9 @@ class UsersController extends Controller
|
|||
} else {Log::info("No current season");}
|
||||
|
||||
$nextRoundName="";
|
||||
$nextRoundId = Round::getFirstIncompleteRound();
|
||||
if ($nextRoundId>-1) { $nextRoundName = Round::where('id','=',$nextRoundId)->first()->name; }
|
||||
$nextRound = Round::getFirstTippableRound();
|
||||
|
||||
if ($nextRound) { $nextRoundName = $nextRound->name; }
|
||||
|
||||
$user=Auth::user();
|
||||
$message_text_tipps="";
|
||||
|
|
@ -134,10 +133,7 @@ class UsersController extends Controller
|
|||
|
||||
$paid_date_str="";
|
||||
$val=User::payment_date($user_id, $season_id);
|
||||
Log::info("UserController:edit => payment_date=".$val);
|
||||
|
||||
if ($val) { $paid_date_str=User::toGermanDate($val);}
|
||||
Log::info("German Date=".$paid_date_str);
|
||||
|
||||
return view ('users.edit', compact('user','paid_date_str'));
|
||||
}
|
||||
|
|
@ -489,4 +485,22 @@ class UsersController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
//route: useredit => useredit view
|
||||
public function useredit($user_id) {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
|
||||
$user=Auth::user();
|
||||
|
||||
$paid_date_str="";
|
||||
$val=User::payment_date($user_id, Season::getCurrent()->id);
|
||||
if ($val) { $paid_date_str=User::toGermanDate($val);}
|
||||
|
||||
return view ('users.useredit', compact('user','paid_date_str'));
|
||||
}
|
||||
|
||||
public function send_reset_links_from_settings() {
|
||||
if (Auth::guest()) { return redirect("/"); }
|
||||
$this->sendResetLink(Auth::user());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ class Round extends Model
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function getLastLockedRoundId() {
|
||||
$season = Season::getCurrent();
|
||||
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
|
||||
|
|
@ -78,6 +80,18 @@ class Round extends Model
|
|||
return $lastLockedRoundId;
|
||||
}
|
||||
|
||||
public static function getFirstTippableRound() {
|
||||
$season = Season::getCurrent();
|
||||
$rounds=Round::where('season_id','=',$season->id)->orderBy('id')->get();
|
||||
$locked = false;
|
||||
foreach ($rounds as $round) {
|
||||
if (!Round::hasLockedGame($round->id) ) {
|
||||
return $round;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getClosestRoundToNow() {
|
||||
$sql="select round_id,DATEDIFF(NOW(),kickoff) from games order by 2 desc limit 1;";
|
||||
$result=DB::select($sql);
|
||||
|
|
|
|||
|
|
@ -191,7 +191,6 @@ class Tipp extends Model
|
|||
['user_id','=',$user_id]]
|
||||
)->first();
|
||||
if (! $tipp) {
|
||||
Log::info('Creating missing tip: game_id=' . $game->id . ", user_id=" . $user->id);
|
||||
$tipp=Tipp::create([
|
||||
'user_id' => $user_id,
|
||||
'game_id'=> $game->id,
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class User extends Authenticatable
|
|||
}
|
||||
|
||||
public static function hasMissingTipp($user_id) {
|
||||
$round_id = Round::getFirstIncompleteRound();
|
||||
$round_id = Round::getFirstTippableRound()->id;
|
||||
$games = Game::where('round_id','=',$round_id)->get();
|
||||
|
||||
foreach ($games as $game) {
|
||||
|
|
@ -146,8 +146,7 @@ class User extends Authenticatable
|
|||
}
|
||||
|
||||
public static function hasMissingJoker($user_id) {
|
||||
$round_id = Round::getFirstIncompleteRound();
|
||||
//Log::info("round_id for jokercheck=".$round_id);
|
||||
$round_id = Round::getFirstTippableRound()->id;
|
||||
$games = Game::where('round_id','=',$round_id." user_id=".$user_id)->get();
|
||||
$joker=0;
|
||||
foreach ($games as $game) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue