This commit is contained in:
salam committed 2026-09-17 11:15:34 +02:00
1 parent 6365f60151
commit 2450ba626e
1 file changed
+7 -57
+7 -57
View File
@@ -11,7 +11,6 @@ use App\Models\SofaScorePlayerPosition;
use App\Models\SofaScoreRosa;
use App\Models\SsLineupMemory;
use App\Models\StatisticFixtures;
use App\Models\StatistikoEvent;
use Filament\Notifications\Notification;
use Filament\Widgets\Widget;
use Illuminate\Support\Facades\Auth;
@@ -375,6 +374,7 @@ class PlayerPropsDrop extends Widget
$tmp['id'] = $ss_player_id;
$tmp['name'] = $val->details->player_name;
$tmp['total_events'] = $val->total_events;
$tmp['id_team'] = $team_id;
$tmp['asp_team'] = $asp_team;
$tmp['player_count_without_gk'] = $count_player;
@@ -394,7 +394,6 @@ class PlayerPropsDrop extends Widget
// Somma Minuti Giocati da Player (SMG) nel DB
$tmp['somma_minuti'] = $val->total_min;
$tmp['shots_on_target'] = $val->shots_on_target;
$tmp['shots_off_target'] = $val->shots_off_target;
$tmp['shots_blocked'] = $val->shots_blocked;
@@ -549,12 +548,12 @@ class PlayerPropsDrop extends Widget
foreach ($results as $key => $result) {
if ((int) $record['id'] == (int) $result['id']) {
$this->players[$k]['active'] = $result['active'];
$this->players[$k]['gls'] = number_format($result['asp_player_goals'], 3);
$this->players[$k]['fls'] = number_format($result['asp_player_fouls'], 3);
$this->players[$k]['ofs'] = number_format($result['asp_player_offsides'], 3);
$this->players[$k]['snt'] = number_format($result['asp_player_total_shots'], 3);
$this->players[$k]['tsh'] = number_format($result['asp_player_shots_on_target'], 3);
$this->players[$k]['crd'] = number_format($result['asp_player_cards'], 3);
$this->players[$k]['gls'] = $result['total_events'] ? number_format($result['asp_player_goals'], 3) : 0;
$this->players[$k]['fls'] = $result['total_events'] ? number_format($result['asp_player_fouls'], 3) : 0;
$this->players[$k]['ofs'] = $result['total_events'] ? number_format($result['asp_player_offsides'], 3) : 0;
$this->players[$k]['snt'] = $result['total_events'] ? number_format($result['asp_player_total_shots'], 3) : 0;
$this->players[$k]['tsh'] = $result['total_events'] ? number_format($result['asp_player_shots_on_target'], 3) : 0;
$this->players[$k]['crd'] = $result['total_events'] ? number_format($result['asp_player_cards'], 3) : 0;
}
}
}
@@ -573,53 +572,4 @@ class PlayerPropsDrop extends Widget
return false;
}
public function loadOthers(int $count_player, int $team_id)
{
$arr = [];
$arr['goals'] = 0;
$arr['fouls'] = 0;
$arr['offside'] = 0;
$arr['card'] = 0;
$arr['snt'] = 0;
$arr['tsh'] = 0;
$res = StatistikoEvent::where(function ($query) use ($team_id) {
return $query->orWhere('home_id', $team_id)
->orWhere('away_id', '=', $team_id);
})->get();
$count_events = 0;
foreach ($res as $value) {
$count_events++;
if ($value->home_id == $team_id) {
$arr['goals'] += $value->gls_h;
$arr['fouls'] += $value->fls_h;
$arr['offside'] += $value->ofs_h;
$arr['card'] += $value->crd_h;
$arr['snt'] += $value->snt_h;
$arr['tsh'] += $value->tsh_h;
}
if ($value->away_id == $team_id) {
$arr['goals'] += $value->gls_a;
$arr['fouls'] += $value->fls_a;
$arr['offside'] += $value->ofs_a;
$arr['card'] += $value->crd_a;
$arr['snt'] += $value->snt_a;
$arr['tsh'] += $value->tsh_a;
}
}
$aspettativa = round($arr['fouls'] / $count_events, 1);
dd($arr['fouls'], $aspettativa, $count_events);
foreach ($arr as $name => $value) {
$arr['asp_team_riferimento_'.$name] = (float) round($value / $count_events, 1) * $count_player / 10;
}
dd($arr);
return $arr;
}
}