wip pp
This commit is contained in:
1 parent
f9c0c5aec5
commit
e0c1baf849
6 files changed
+32
-22
No files matched your search
@@ -4,6 +4,7 @@ namespace App\Filament\Pages\Selections;
|
|||||||
|
|
||||||
use App\Filament\Pages\Selections\Helper\GetSeason;
|
use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||||
use App\Models\SofaScorePlayerPerSeason;
|
use App\Models\SofaScorePlayerPerSeason;
|
||||||
|
use App\Models\StatistikoDetail;
|
||||||
use App\Models\StatistikoEvent;
|
use App\Models\StatistikoEvent;
|
||||||
|
|
||||||
class LoadPlayerSelection
|
class LoadPlayerSelection
|
||||||
@@ -35,12 +36,12 @@ class LoadPlayerSelection
|
|||||||
|
|
||||||
$positions_map = LoadPositions::load();
|
$positions_map = LoadPositions::load();
|
||||||
|
|
||||||
$player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->whereIn('season', $season)->get();
|
$team_player_ids = StatistikoDetail::where('ss_team_id', $team_id)->pluck('ss_player_id')->toArray();
|
||||||
|
|
||||||
// dd($player);
|
$players = SofaScorePlayerPerSeason::with('details')->where('season', $season)->whereIn('ss_player_id', $team_player_ids)->get();
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($player as $val) {
|
foreach ($players as $val) {
|
||||||
if ($val->details) {
|
if ($val->details) {
|
||||||
$player_id = $val->ss_player_id;
|
$player_id = $val->ss_player_id;
|
||||||
if (! isset($arr[$player_id])) {
|
if (! isset($arr[$player_id])) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class BoxNames
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
2 => 'DL',
|
2 => 'DL',
|
||||||
4 => 'MR',
|
4 => 'ML',
|
||||||
6 => 'LW',
|
6 => 'LW',
|
||||||
9 => 'DC',
|
9 => 'DC',
|
||||||
10 => 'DM',
|
10 => 'DM',
|
||||||
@@ -26,7 +26,7 @@ class BoxNames
|
|||||||
25 => 'MC',
|
25 => 'MC',
|
||||||
26 => 'AM',
|
26 => 'AM',
|
||||||
30 => 'DR',
|
30 => 'DR',
|
||||||
32 => 'ML',
|
32 => 'MR',
|
||||||
34 => 'RW',
|
34 => 'RW',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use App\Models\SofaScorePlayerPosition;
|
|||||||
use App\Models\SofaScoreRosa;
|
use App\Models\SofaScoreRosa;
|
||||||
use App\Models\SsLineupMemory;
|
use App\Models\SsLineupMemory;
|
||||||
use App\Models\StatisticFixtures;
|
use App\Models\StatisticFixtures;
|
||||||
|
use App\Models\StatistikoDetail;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@@ -390,7 +391,9 @@ class PlayerPropsDrop extends Widget
|
|||||||
$team_home_away = 'away';
|
$team_home_away = 'away';
|
||||||
}
|
}
|
||||||
|
|
||||||
$player_totals = SofaScorePlayerPerSeason::with('details')->where('total_min', '>', 0)->where('season', 'total')->where('ss_team_id', $team_id)->get();
|
$team_player_ids = StatistikoDetail::where('ss_team_id', $team_id)->pluck('ss_player_id')->toArray();
|
||||||
|
|
||||||
|
$player_totals = SofaScorePlayerPerSeason::with('details')->where('season', 'total')->whereIn('ss_player_id', $team_player_ids)->get();
|
||||||
|
|
||||||
$count_player = 0;
|
$count_player = 0;
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
@@ -682,7 +685,9 @@ class PlayerPropsDrop extends Widget
|
|||||||
|
|
||||||
public function prepareLineUp()
|
public function prepareLineUp()
|
||||||
{
|
{
|
||||||
$players = SofaScorePlayerPerSeason::with('details')->where('total_min', '>', 0)->where('season', 'last_180_days')->where('ss_team_id', $this->team_id)->get();
|
$team_player_ids = StatistikoDetail::where('ss_team_id', $this->team_id)->pluck('ss_player_id')->toArray();
|
||||||
|
|
||||||
|
$players = SofaScorePlayerPerSeason::with('details')->where('season', 'last_180_days')->whereIn('ss_player_id', $team_player_ids)->get();
|
||||||
|
|
||||||
$arr = collect();
|
$arr = collect();
|
||||||
foreach ($players as $value) {
|
foreach ($players as $value) {
|
||||||
@@ -809,7 +814,8 @@ class PlayerPropsDrop extends Widget
|
|||||||
|
|
||||||
public function getPlayerForPosition(array &$lineup, array &$id_used, int $place, Collection $players)
|
public function getPlayerForPosition(array &$lineup, array &$id_used, int $place, Collection $players)
|
||||||
{
|
{
|
||||||
$log = false;
|
$log = 0;
|
||||||
|
|
||||||
$position = $this->activeBoxes[$place];
|
$position = $this->activeBoxes[$place];
|
||||||
|
|
||||||
$hirarchy = PositionHirarchie::load();
|
$hirarchy = PositionHirarchie::load();
|
||||||
@@ -830,7 +836,7 @@ class PlayerPropsDrop extends Widget
|
|||||||
$fitered = $players->where('pos', $position2)->whereNotIn('id', $id_used)->sortByDesc('min')->first();
|
$fitered = $players->where('pos', $position2)->whereNotIn('id', $id_used)->sortByDesc('min')->first();
|
||||||
|
|
||||||
if (isset($fitered['id'])) {
|
if (isset($fitered['id'])) {
|
||||||
$lineup[$fitered['id']] = ['id' => $fitered['id'], 'min' => $fitered['min'], 'place' => $place, 'position' => $position2];
|
$lineup[$fitered['id']] = ['id' => $fitered['id'], 'min' => $fitered['min'], 'place' => $place, 'position' => $position];
|
||||||
$id_used[] = $fitered['id'];
|
$id_used[] = $fitered['id'];
|
||||||
if ($log) {
|
if ($log) {
|
||||||
Log::debug("B $place - $position $position2", $fitered);
|
Log::debug("B $place - $position $position2", $fitered);
|
||||||
@@ -845,7 +851,7 @@ class PlayerPropsDrop extends Widget
|
|||||||
Log::debug("C $place - $position $position2 $position3", $fitered);
|
Log::debug("C $place - $position $position2 $position3", $fitered);
|
||||||
}
|
}
|
||||||
|
|
||||||
$lineup[$fitered['id']] = ['id' => $fitered['id'], 'min' => $fitered['min'], 'place' => $place, 'position' => $position3];
|
$lineup[$fitered['id']] = ['id' => $fitered['id'], 'min' => $fitered['min'], 'place' => $place, 'position' => $position];
|
||||||
$id_used[] = $fitered['id'];
|
$id_used[] = $fitered['id'];
|
||||||
} elseif (isset($hirarchy[$position][2])) {
|
} elseif (isset($hirarchy[$position][2])) {
|
||||||
$position4 = $hirarchy[$position][2];
|
$position4 = $hirarchy[$position][2];
|
||||||
@@ -856,7 +862,7 @@ class PlayerPropsDrop extends Widget
|
|||||||
Log::debug("D $place - $position $position2 $position3 $position4", $fitered);
|
Log::debug("D $place - $position $position2 $position3 $position4", $fitered);
|
||||||
}
|
}
|
||||||
|
|
||||||
$lineup[$fitered['id']] = ['id' => $fitered['id'], 'min' => $fitered['min'], 'place' => $place, 'position' => $position4];
|
$lineup[$fitered['id']] = ['id' => $fitered['id'], 'min' => $fitered['min'], 'place' => $place, 'position' => $position];
|
||||||
$id_used[] = $fitered['id'];
|
$id_used[] = $fitered['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ class LoadGridPositions
|
|||||||
$arr[] = 'DM';
|
$arr[] = 'DM';
|
||||||
$arr[] = 0;
|
$arr[] = 0;
|
||||||
|
|
||||||
$arr[] = 'MR';
|
|
||||||
$arr[] = 'MC';
|
|
||||||
$arr[] = 'MC';
|
|
||||||
$arr[] = 'MC';
|
|
||||||
$arr[] = 'ML';
|
$arr[] = 'ML';
|
||||||
|
$arr[] = 'MC';
|
||||||
|
$arr[] = 'MC';
|
||||||
|
$arr[] = 'MC';
|
||||||
|
$arr[] = 'MR';
|
||||||
|
|
||||||
$arr[] = 0;
|
$arr[] = 0;
|
||||||
$arr[] = 'AM';
|
$arr[] = 'AM';
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Livewire;
|
|||||||
|
|
||||||
use App\Filament\Pages\Selections\LoadPositions;
|
use App\Filament\Pages\Selections\LoadPositions;
|
||||||
use App\Models\SofaScorePlayerPerSeason;
|
use App\Models\SofaScorePlayerPerSeason;
|
||||||
|
use App\Models\StatistikoDetail;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class PlayerCalculator extends Component
|
class PlayerCalculator extends Component
|
||||||
@@ -12,10 +13,12 @@ class PlayerCalculator extends Component
|
|||||||
{
|
{
|
||||||
$positions_map = LoadPositions::load();
|
$positions_map = LoadPositions::load();
|
||||||
|
|
||||||
$player = SofaScorePlayerPerSeason::with('details')->where('season', 'total')->where('ss_team_id', $team_id)->get();
|
$team_player_ids = StatistikoDetail::where('ss_team_id', $team_id)->pluck('ss_player_id')->toArray();
|
||||||
|
|
||||||
|
$players = SofaScorePlayerPerSeason::with('details')->where('season', 'total')->whereIn('ss_player_id', $team_player_ids)->get();
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($player as $val) {
|
foreach ($players as $val) {
|
||||||
if ($val->details != null && $val->details->is_active) {
|
if ($val->details != null && $val->details->is_active) {
|
||||||
|
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ trait UpdateHelper
|
|||||||
$ss_player_id = (int) $val->ss_player_id;
|
$ss_player_id = (int) $val->ss_player_id;
|
||||||
$activeteam_id = (int) $val->activeteam_id;
|
$activeteam_id = (int) $val->activeteam_id;
|
||||||
$minutes_played = (int) $val->minutes_played;
|
$minutes_played = (int) $val->minutes_played;
|
||||||
$ss_team_id = (int) $val->details->ss_team_id;
|
// $ss_team_id = (int) $val->details->ss_team_id;
|
||||||
$season = $val->event->season;
|
$season = $val->event->season;
|
||||||
$home_id = (int) $val->event->home_id;
|
$home_id = (int) $val->event->home_id;
|
||||||
$away_id = (int) $val->event->away_id;
|
$away_id = (int) $val->event->away_id;
|
||||||
@@ -177,7 +177,7 @@ trait UpdateHelper
|
|||||||
$cards = $val->card_yellow + $val->card_yellowred;
|
$cards = $val->card_yellow + $val->card_yellowred;
|
||||||
|
|
||||||
$collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
$collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||||
$collection[$season][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
// $collection[$season][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||||
$collection[$season][$ss_player_id]['season'] = $season;
|
$collection[$season][$ss_player_id]['season'] = $season;
|
||||||
$collection[$season][$ss_player_id]['total_events']++;
|
$collection[$season][$ss_player_id]['total_events']++;
|
||||||
$collection[$season][$ss_player_id]['total_min'] += $minutes_played;
|
$collection[$season][$ss_player_id]['total_min'] += $minutes_played;
|
||||||
@@ -192,7 +192,7 @@ trait UpdateHelper
|
|||||||
$collection[$season][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked;
|
$collection[$season][$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked;
|
||||||
|
|
||||||
$collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
$collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||||
$collection['total'][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
// $collection['total'][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||||
$collection['total'][$ss_player_id]['season'] = 'total';
|
$collection['total'][$ss_player_id]['season'] = 'total';
|
||||||
$collection['total'][$ss_player_id]['total_events']++;
|
$collection['total'][$ss_player_id]['total_events']++;
|
||||||
$collection['total'][$ss_player_id]['total_min'] += $minutes_played;
|
$collection['total'][$ss_player_id]['total_min'] += $minutes_played;
|
||||||
@@ -208,7 +208,7 @@ trait UpdateHelper
|
|||||||
|
|
||||||
if ($last_180_days) {
|
if ($last_180_days) {
|
||||||
$collection['last_180_days'][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
$collection['last_180_days'][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||||
$collection['last_180_days'][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
// $collection['last_180_days'][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||||
$collection['last_180_days'][$ss_player_id]['season'] = 'last_180_days';
|
$collection['last_180_days'][$ss_player_id]['season'] = 'last_180_days';
|
||||||
$collection['last_180_days'][$ss_player_id]['total_events']++;
|
$collection['last_180_days'][$ss_player_id]['total_events']++;
|
||||||
$collection['last_180_days'][$ss_player_id]['total_min'] += $minutes_played;
|
$collection['last_180_days'][$ss_player_id]['total_min'] += $minutes_played;
|
||||||
@@ -237,7 +237,7 @@ trait UpdateHelper
|
|||||||
$collection_1d,
|
$collection_1d,
|
||||||
uniqueBy: [
|
uniqueBy: [
|
||||||
'ss_player_id',
|
'ss_player_id',
|
||||||
'ss_team_id',
|
// 'ss_team_id',
|
||||||
'season',
|
'season',
|
||||||
],
|
],
|
||||||
update: [
|
update: [
|
||||||
|
|||||||
Reference in new issue
Block a user