This commit is contained in:
salam committed 2026-09-18 19:31:08 +02:00
1 parent e9921ea26d
commit fafa2bd1a6
1 file changed
+44 -42
+44 -42
View File
@@ -594,60 +594,62 @@ class PlayerPropsDrop extends Widget
}
}
$map = [];
$res = ExpectedMinimumPosition::all();
foreach ($res as $val) {
$map[$val->position]['gls'] = $val->gls;
$map[$val->position]['crd'] = $val->crd;
$map[$val->position]['fls'] = $val->fls;
$map[$val->position]['ofs'] = $val->ofs;
$map[$val->position]['tsh'] = $val->tsh;
$map[$val->position]['snt'] = $val->snt;
}
foreach ($this->players as $k => $player) {
foreach ($results as $key => $result) {
if ((int) $player['id'] == (int) $result['id']) {
$this->players[$k]['active'] = $result['active'];
$pos = $this->players[$k]['pos'];
if (!$pos)
$pos = $this->players[$k]['pos_ori'];
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('gls', '>', $result['asp_player_goals'])->first();
$results[$key]['asp_mini_pos_gls'] = $min->gls ?? 0;
if ($min) {
$this->players[$k]['gls'] = number_format($min->gls, 3);
} else {
$this->players[$k]['gls'] = number_format($result['asp_player_goals'], 3);
}
$tamx = number_format($map[$pos]['gls'], 3);
$final = number_format($result['asp_player_goals'], 3);
$results[$key]['finale_tamx_gls'] = $tamx;
$results[$key]['finale_calc_gls'] = $final;
$this->players[$k]['gls'] = $final > $tamx ? $final : $tamx;
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('fls', '>', $result['asp_player_fouls'])->first();
$results[$key]['asp_mini_pos_fls'] = $min->fls ?? 0;
if ($min) {
$this->players[$k]['fls'] = number_format($min->fls, 3);
} else {
$this->players[$k]['fls'] = number_format($result['asp_player_fouls'], 3);
}
$tamx = number_format($map[$pos]['fls'], 3);
$final = number_format($result['asp_player_fouls'], 3);
$results[$key]['finale_tamx_fls'] = $tamx;
$results[$key]['finale_calc_fls'] = $final;
$this->players[$k]['fls'] = $final > $tamx ? $final : $tamx;
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('ofs', '>', $result['asp_player_offsides'])->first();
$results[$key]['asp_mini_pos_ofs'] = $min->ofs ?? 0;
if ($min) {
$this->players[$k]['ofs'] = number_format($min->ofs, 3);
} else {
$this->players[$k]['ofs'] = number_format($result['asp_player_offsides'], 3);
}
$tamx = number_format($map[$pos]['ofs'], 3);
$final = number_format($result['asp_player_offsides'], 3);
$results[$key]['finale_tamx_ofs'] = $tamx;
$results[$key]['finale_calc_ofs'] = $final;
$this->players[$k]['ofs'] = $final > $tamx ? $final : $tamx;
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('snt', '>', $result['asp_player_shots_on_target'])->first();
$results[$key]['asp_mini_pos_snt'] = $min->snt ?? 0;
if ($min) {
$this->players[$k]['snt'] = number_format($min->snt, 3);
} else {
$this->players[$k]['snt'] = number_format($result['asp_player_total_shots'], 3);
}
$tamx = number_format($map[$pos]['snt'], 3);
$final = number_format($result['asp_player_shots_on_target'], 3);
$results[$key]['finale_tamx_snt'] = $tamx;
$results[$key]['finale_calc_snt'] = $final;
$this->players[$k]['snt'] = $final > $tamx ? $final : $tamx;
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('tsh', '>', $result['asp_player_total_shots'])->first();
$results[$key]['asp_mini_pos_tsh'] = $min->tsh ?? 0;
if ($min) {
$this->players[$k]['tsh'] = number_format($min->tsh, 3);
} else {
$this->players[$k]['tsh'] = number_format($result['asp_player_shots_on_target'], 3);
}
$tamx = number_format($map[$pos]['tsh'], 3);
$final = number_format($result['asp_player_total_shots'], 3);
$results[$key]['finale_tamx_tsh'] = $tamx;
$results[$key]['finale_calc_tsh'] = $final;
$this->players[$k]['tsh'] = $final > $tamx ? $final : $tamx;
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('crd', '>', $result['asp_player_cards'])->first();
$results[$key]['asp_mini_pos_crd'] = $min->crd ?? 0;
if ($min) {
$this->players[$k]['crd'] = number_format($min->crd, 3);
} else {
$this->players[$k]['crd'] = number_format($result['asp_player_cards'], 3);
}
$tamx = number_format($map[$pos]['crd'], 3);
$final = number_format($result['asp_player_cards'], 3);
$results[$key]['finale_tamx_crd'] = $tamx;
$results[$key]['finale_calc_crd'] = $final;
$this->players[$k]['crd'] = $final > $tamx ? $final : $tamx;
}
}
}