wip add wfl

This commit is contained in:
salam committed 2026-10-30 09:26:37 +01:00
1 parent a125dddb4c
commit bf5e06848a
17 files changed
+188 -43

No files matched your search

+34 -4
View File
@@ -155,6 +155,7 @@ class PlayerPropsDrop extends Widget
$tmp['crd'] = $val['cards'];
$tmp['snt'] = $val['shots_on_target'];
$tmp['tsh'] = $val['shots_off_target'];
$tmp['wfl'] = $val['was_fouled'];
$level = round($val['total_events'] / 3);
if ($val['total_events']) {
@@ -383,6 +384,7 @@ class PlayerPropsDrop extends Widget
$this->players[$k]['crd'] = '';
$this->players[$k]['snt'] = '';
$this->players[$k]['tsh'] = '';
$this->players[$k]['wfl'] = '';
}
$this->storePlacement();
@@ -407,6 +409,7 @@ class PlayerPropsDrop extends Widget
$this->players[$k]['crd'] = '';
$this->players[$k]['snt'] = '';
$this->players[$k]['tsh'] = '';
$this->players[$k]['wfl'] = '';
}
$this->player_on_field_counter = 0;
@@ -450,7 +453,7 @@ class PlayerPropsDrop extends Widget
return;
}
$header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'crd', 'snt', 'tsh'];
$header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'crd', 'snt', 'tsh', 'wfl'];
$copystring = implode(';', $header)."\n";
foreach ($this->players as $row) {
$tmp = [];
@@ -470,6 +473,7 @@ class PlayerPropsDrop extends Widget
$tmp[] = $row['crd'];
$tmp[] = $row['snt'];
$tmp[] = $row['tsh'];
$tmp[] = $row['wfl'];
$copystring .= implode(';', $tmp)."\n";
}
@@ -491,6 +495,7 @@ class PlayerPropsDrop extends Widget
$this->players[$k]['crd'] = '';
$this->players[$k]['snt'] = '';
$this->players[$k]['tsh'] = '';
$this->players[$k]['wfl'] = '';
}
$this->dispatch('update-players', players: $this->players);
@@ -597,7 +602,7 @@ class PlayerPropsDrop extends Widget
// exp_total_shots
// exp_shots_on_target
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target'];
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target', 'was_fouled'];
foreach ($bettypes as $bettype) {
$asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_'.$bettype);
@@ -673,6 +678,16 @@ class PlayerPropsDrop extends Widget
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
}
break;
case 'was_fouled':
$asp_gioco = $val['was_fouled'] / $val['total_min'] * 90;
if ($asp_gioco == 0 || $val['total_min'] < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = 0;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else {
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
}
break;
}
}
@@ -689,7 +704,7 @@ class PlayerPropsDrop extends Widget
// (ATR) = Aspettativa Team * Numero di Giocatori di Team in Rosters (esclusi i portieri) / 10.
// Ad esempio per Remo (supponiamo 24 giocatori nel Roster esclusi i portieri): ATR = 1.2 * 24 / 10 = 2.88
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target'];
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target', 'was_fouled'];
foreach ($bettypes as $bettype) {
$total_bettype = array_sum(array_column($results, 'asp_teorica_'.$bettype));
@@ -736,6 +751,12 @@ class PlayerPropsDrop extends Widget
$results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
break;
case 'was_fouled':
$asp_team_riferimento = (float) $asp_team_all[$team_home_away]['wfl'] * $count_player / 10;
$results[$key]['asp_team_riferimento_wfl'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
break;
}
}
}
@@ -749,9 +770,10 @@ class PlayerPropsDrop extends Widget
$map[$val->position]['ofs'] = $val->ofs;
$map[$val->position]['tsh'] = $val->tsh;
$map[$val->position]['snt'] = $val->snt;
$map[$val->position]['wfl'] = $val->wfl;
}
// stesso ordine di prima: GLS, CRD, FLS, OFS, TSH, SNT
// stesso ordine di prima: GLS, CRD, FLS, OFS, TSH, SNT, WFL
foreach ($this->players as $k => $player) {
foreach ($results as $key => $result) {
@@ -800,6 +822,12 @@ class PlayerPropsDrop extends Widget
$results[$key]['finale_tamx_snt'] = $tamx;
$results[$key]['finale_calc_snt'] = $final;
$this->players[$k]['snt'] = (float) $final > (float) $tamx ? $final : $tamx;
$tamx = number_format($map[$pos]['wfl'], 3);
$final = number_format($result['asp_player_was_fouled'], 3);
$results[$key]['finale_tamx_wfl'] = $tamx;
$results[$key]['finale_calc_wfl'] = $final;
$this->players[$k]['wfl'] = (float) $final > (float) $tamx ? $final : $tamx;
}
}
}
@@ -1106,6 +1134,7 @@ class PlayerPropsDrop extends Widget
$arr[$ss_player_id]['shots_off_target'] += $val->shots_off_target;
$arr[$ss_player_id]['shots_blocked'] += $val->shots_blocked;
$arr[$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked;
$arr[$ss_player_id]['was_fouled'] += $val->was_fouled;
}
foreach ($players as $value) {
@@ -1138,6 +1167,7 @@ class PlayerPropsDrop extends Widget
$arr[$ss_player_id]['shots_off_target'] = 0;
$arr[$ss_player_id]['shots_blocked'] = 0;
$arr[$ss_player_id]['total_shots'] = 0;
$arr[$ss_player_id]['was_fouled'] = 0;
$arr[$ss_player_id]['cards'] = 0;
}
}