wip
This commit is contained in:
1 parent
b961a3ad7c
commit
da528df0e7
1 file changed
+64
-46
@@ -555,8 +555,6 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
// Il valore Y dovrebbe essere configurabile in una interfaccia. Il valore iniziale lo fissiamo a Y = 180
|
// Il valore Y dovrebbe essere configurabile in una interfaccia. Il valore iniziale lo fissiamo a Y = 180
|
||||||
|
|
||||||
// Somma Minuti Giocati da Player (SMG) nel DB
|
// Somma Minuti Giocati da Player (SMG) nel DB
|
||||||
$somma_minuti = $val->total_min;
|
|
||||||
$tmp['somma_minuti'] = $val->total_min;
|
|
||||||
|
|
||||||
// il valore corrispondente al ruolo del Player (esempio un giocatore in Details ha ruolo = RW
|
// il valore corrispondente al ruolo del Player (esempio un giocatore in Details ha ruolo = RW
|
||||||
// quindi Aspettativa Statistica (AS) per RW = 0.219)
|
// quindi Aspettativa Statistica (AS) per RW = 0.219)
|
||||||
@@ -569,59 +567,79 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
// exp_total_shots
|
// exp_total_shots
|
||||||
// exp_shots_on_target
|
// exp_shots_on_target
|
||||||
|
|
||||||
|
$somma_minuti = $val->total_min;
|
||||||
|
|
||||||
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target'];
|
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target'];
|
||||||
foreach ($bettypes as $bettype) {
|
foreach ($bettypes as $bettype) {
|
||||||
|
|
||||||
$asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_' . $bettype);
|
$asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_' . $bettype);
|
||||||
|
|
||||||
$tmp['asp_statistica_' . $bettype] = $asp_statistica;
|
$tmp['asp_statistica_' . $bettype] = $asp_statistica;
|
||||||
|
|
||||||
if ($val->total_min < $this->y_value) {
|
switch ($bettype) {
|
||||||
// Se la SMG è < Y per quel Player prenderemo in considerazione solo l'Aspettativa Statistica (AS).
|
case 'goals':
|
||||||
$tmp['asp_gioco_' . $bettype] = 0;
|
if ($val->total_min < $this->y_value || $val->goals == 0) {
|
||||||
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
} else {
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_statistica) / (1 + $this->x_value);
|
||||||
// Aspettativa Teorica (AT) Goals = (X * AdG + AS) / (1 + X)
|
} else {
|
||||||
// dove X è un valore che dovrebbe essere parametrizzabile da una interfaccia.
|
$asp_gioco = $val->goals / $val->total_min * 90;
|
||||||
// Il valore iniziale lo fissiamo a X = 3
|
$tmp['asp_gioco_' . $bettype] = $asp_gioco;
|
||||||
// (AT)
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
switch ($bettype) {
|
}
|
||||||
case 'goals':
|
break;
|
||||||
// Aspettativa di Gioco
|
case 'cards':
|
||||||
// (AdG)
|
if ($val->total_min < $this->y_value || $val->cards == 0) {
|
||||||
$asp_gioco = $val->goals / $somma_minuti * 90;
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
$tmp['asp_gioco_goals'] = $asp_gioco;
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_statistica) / (1 + $this->x_value);
|
||||||
$tmp['asp_teorica_goals'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
} else {
|
||||||
break;
|
$asp_gioco = $val->cards / $val->total_min * 90;
|
||||||
case 'cards':
|
$tmp['asp_gioco_' . $bettype] = $asp_gioco;
|
||||||
$asp_gioco = $val->cards / $somma_minuti * 90;
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
$tmp['asp_gioco_cards'] = $asp_gioco;
|
}
|
||||||
$tmp['asp_teorica_cards'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
break;
|
||||||
break;
|
case 'fouls':
|
||||||
case 'fouls':
|
if ($val->total_min < $this->y_value || $val->fouls == 0) {
|
||||||
$asp_gioco = $val->fouls / $somma_minuti * 90;
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
$tmp['asp_gioco_fouls'] = $asp_gioco;
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_statistica) / (1 + $this->x_value);
|
||||||
$tmp['asp_teorica_fouls'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
} else {
|
||||||
break;
|
$asp_gioco = $val->fouls / $val->total_min * 90;
|
||||||
case 'offsides':
|
$tmp['asp_gioco_' . $bettype] = $asp_gioco;
|
||||||
$asp_gioco = $val->offsides / $somma_minuti * 90;
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
$tmp['asp_gioco_offsides'] = $asp_gioco;
|
}
|
||||||
$tmp['asp_teorica_offsides'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
break;
|
||||||
break;
|
case 'offsides':
|
||||||
case 'total_shots':
|
if ($val->total_min < $this->y_value || $val->offsides == 0) {
|
||||||
$asp_gioco = $val->total_shots / $somma_minuti * 90;
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
$tmp['asp_gioco_total_shots'] = $asp_gioco;
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_statistica) / (1 + $this->x_value);
|
||||||
$tmp['asp_teorica_total_shots'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
} else {
|
||||||
break;
|
$asp_gioco = $val->offsides / $val->total_min * 90;
|
||||||
case 'shots_on_target':
|
$tmp['asp_gioco_' . $bettype] = $asp_gioco;
|
||||||
$asp_gioco = $val->shots_on_target / $somma_minuti * 90;
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
$tmp['asp_gioco_shots_on_target'] = $asp_gioco;
|
}
|
||||||
$tmp['asp_teorica_shots_on_target'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
break;
|
||||||
break;
|
case 'total_shots':
|
||||||
}
|
if ($val->total_min < $this->y_value || $val->total_shots == 0) {
|
||||||
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_statistica) / (1 + $this->x_value);
|
||||||
|
} else {
|
||||||
|
$asp_gioco = $val->total_shots / $val->total_min * 90;
|
||||||
|
$tmp['asp_gioco_' . $bettype] = $asp_gioco;
|
||||||
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'shots_on_target':
|
||||||
|
if ($val->total_min < $this->y_value || $val->shots_on_target == 0) {
|
||||||
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_statistica) / (1 + $this->x_value);
|
||||||
|
} else {
|
||||||
|
$asp_gioco = $val->shots_on_target / $val->total_min * 90;
|
||||||
|
$tmp['asp_gioco_' . $bettype] = $asp_gioco;
|
||||||
|
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calcolare la Somma di tutte le AT (colonna G della Tabella)
|
// Calcolare la Somma di tutte le AT (colonna G della Tabella)
|
||||||
// Considerare la ATR calcolata allo Step 1 (colonna I della Tabella)
|
// Considerare la ATR calcolata allo Step 1 (colonna I della Tabella)
|
||||||
// Aspettativa per Player: AP = AT * ATR / TOT AT
|
// Aspettativa per Player: AP = AT * ATR / TOT AT
|
||||||
|
|||||||
Reference in new issue
Block a user