wip
This commit is contained in:
1 parent
d793f0b844
commit
326451aa7f
1 file changed
+17
-18
@@ -249,27 +249,27 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
->modalWidth(Width::ExtraLarge)
|
->modalWidth(Width::ExtraLarge)
|
||||||
->modalSubmitAction(false)
|
->modalSubmitAction(false)
|
||||||
->modalCancelAction(false)
|
->modalCancelAction(false)
|
||||||
->modalContent(fn () => view('filament.modals.position-abbreviation')),
|
->modalContent(fn() => view('filament.modals.position-abbreviation')),
|
||||||
Action::make('reset')
|
Action::make('reset')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->size(Size::Small)
|
->size(Size::Small)
|
||||||
->tooltip('Remove all players from field')
|
->tooltip('Remove all players from field')
|
||||||
->icon('phosphor-arrows-clockwise')
|
->icon('phosphor-arrows-clockwise')
|
||||||
->action(fn () => $this->clearResultTable()),
|
->action(fn() => $this->clearResultTable()),
|
||||||
Action::make('copy_results')
|
Action::make('copy_results')
|
||||||
->tooltip('Copy results for pasting into a spread sheet')
|
->tooltip('Copy results for pasting into a spread sheet')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->size(Size::Small)
|
->size(Size::Small)
|
||||||
->icon('phosphor-copy')
|
->icon('phosphor-copy')
|
||||||
->action(fn () => $this->copyResult()),
|
->action(fn() => $this->copyResult()),
|
||||||
Action::make('copy_development')
|
Action::make('copy_development')
|
||||||
->tooltip('Copy calculation variables')
|
->tooltip('Copy calculation variables')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->size(Size::Small)
|
->size(Size::Small)
|
||||||
->hidden(fn () => ! in_array(Auth::user()->id, [1, 2]))
|
->hidden(fn() => ! in_array(Auth::user()->id, [1, 2]))
|
||||||
->color('warning')
|
->color('warning')
|
||||||
->icon('phosphor-copy')
|
->icon('phosphor-copy')
|
||||||
->action(fn () => $this->copyDevelopment()),
|
->action(fn() => $this->copyDevelopment()),
|
||||||
])
|
])
|
||||||
/**
|
/**
|
||||||
* WICHTIG: Da Filament v5 zwingend eine Query braucht, nutzen wir ein
|
* WICHTIG: Da Filament v5 zwingend eine Query braucht, nutzen wir ein
|
||||||
@@ -282,7 +282,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
->columns([
|
->columns([
|
||||||
ViewColumn::make('drag_card')
|
ViewColumn::make('drag_card')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->label(fn () => $this->getHeadingTable())
|
->label(fn() => $this->getHeadingTable())
|
||||||
->view('filament.tables.columns.drag-card'),
|
->view('filament.tables.columns.drag-card'),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
@@ -298,7 +298,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
'midfield' => '<span class="text-blue-500">Midfield</span>',
|
'midfield' => '<span class="text-blue-500">Midfield</span>',
|
||||||
'defence' => '<span class="text-green-500">Defence</span>',
|
'defence' => '<span class="text-green-500">Defence</span>',
|
||||||
'goalkeeper' => '<span class="text-gray-500">Goalkeeper</span>',
|
'goalkeeper' => '<span class="text-gray-500">Goalkeeper</span>',
|
||||||
])->modifyFormFieldUsing(fn (Select $component) => $component->allowHtml())
|
])->modifyFormFieldUsing(fn(Select $component) => $component->allowHtml())
|
||||||
->query(function ($query) {
|
->query(function ($query) {
|
||||||
return $query;
|
return $query;
|
||||||
})->indicateUsing(function (array $data): array {
|
})->indicateUsing(function (array $data): array {
|
||||||
@@ -423,9 +423,9 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
foreach ($this->calculationVariables as $row) {
|
foreach ($this->calculationVariables as $row) {
|
||||||
if ($copystring == '') {
|
if ($copystring == '') {
|
||||||
$keys = array_keys($row);
|
$keys = array_keys($row);
|
||||||
$copystring .= implode("\t", $keys)."\n";
|
$copystring .= implode(";", $keys) . "\n";
|
||||||
}
|
}
|
||||||
$copystring .= implode("\t", $row)."\n";
|
$copystring .= implode(";", $row) . "\n";
|
||||||
}
|
}
|
||||||
$this->js("navigator.clipboard.writeText(`$copystring`)");
|
$this->js("navigator.clipboard.writeText(`$copystring`)");
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'snt', 'tsh', 'crd'];
|
$header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'snt', 'tsh', 'crd'];
|
||||||
$copystring = implode("\t", $header)."\n";
|
$copystring = implode(";", $header) . "\n";
|
||||||
foreach ($this->sourceRecords as $row) {
|
foreach ($this->sourceRecords as $row) {
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
$tmp[] = $row['name'];
|
$tmp[] = $row['name'];
|
||||||
@@ -461,7 +461,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
$tmp[] = $row['tsh'];
|
$tmp[] = $row['tsh'];
|
||||||
$tmp[] = $row['crd'];
|
$tmp[] = $row['crd'];
|
||||||
|
|
||||||
$copystring .= implode("\t", $tmp)."\n";
|
$copystring .= implode(",", $tmp) . "\n";
|
||||||
}
|
}
|
||||||
$this->js("navigator.clipboard.writeText(`$copystring`)");
|
$this->js("navigator.clipboard.writeText(`$copystring`)");
|
||||||
|
|
||||||
@@ -572,13 +572,13 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
$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) {
|
if ($val->total_min < $this->y_value) {
|
||||||
// Se la SMG è < Y per quel Player prenderemo in considerazione solo l'Aspettativa Statistica (AS).
|
// Se la SMG è < Y per quel Player prenderemo in considerazione solo l'Aspettativa Statistica (AS).
|
||||||
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
|
$tmp['asp_teorica_' . $bettype] = $asp_statistica;
|
||||||
} else {
|
} else {
|
||||||
// Aspettativa Teorica (AT) Goals = (X * AdG + AS) / (1 + X)
|
// Aspettativa Teorica (AT) Goals = (X * AdG + AS) / (1 + X)
|
||||||
// dove X è un valore che dovrebbe essere parametrizzabile da una interfaccia.
|
// dove X è un valore che dovrebbe essere parametrizzabile da una interfaccia.
|
||||||
@@ -611,7 +611,6 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
$asp_gioco = $val->shots_on_target / $somma_minuti * 90;
|
$asp_gioco = $val->shots_on_target / $somma_minuti * 90;
|
||||||
$tmp['asp_teorica_shots_on_target'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
$tmp['asp_teorica_shots_on_target'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -628,11 +627,11 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
|||||||
|
|
||||||
$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) {
|
||||||
$total_bettype = array_sum(array_column($results, 'asp_teorica_'.$bettype));
|
$total_bettype = array_sum(array_column($results, 'asp_teorica_' . $bettype));
|
||||||
foreach ($results as $key => $value) {
|
foreach ($results as $key => $value) {
|
||||||
// Aspettativa per Player: AP = AT * ATR / TOT AT
|
// Aspettativa per Player: AP = AT * ATR / TOT AT
|
||||||
$results[$key]['asp_total_'.$bettype] = $total_bettype;
|
$results[$key]['asp_total_' . $bettype] = $total_bettype;
|
||||||
$results[$key]['asp_player_'.$bettype] = ((float) $value['asp_team'] * (float) $value['asp_teorica_'.$bettype]) / $total_bettype;
|
$results[$key]['asp_player_' . $bettype] = ((float) $value['asp_team'] * (float) $value['asp_teorica_' . $bettype]) / $total_bettype;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user