This commit is contained in:
salam committed 2026-09-18 18:14:25 +02:00
1 parent e9e8db47e0
commit 02f008e1ba
7 files changed
+109 -72

No files matched your search

+37
View File
@@ -6,6 +6,7 @@ use App\Filament\Widgets\PlayerProps\BoxNames;
use App\Filament\Widgets\PlayerProps\Expectations; use App\Filament\Widgets\PlayerProps\Expectations;
use App\Filament\Widgets\PlayerProps\LineUpMap; use App\Filament\Widgets\PlayerProps\LineUpMap;
use App\Livewire\PlayerCalculator; use App\Livewire\PlayerCalculator;
use App\Models\ExpectedMinimumPosition;
use App\Models\SofaScorePlayerPerSeason; use App\Models\SofaScorePlayerPerSeason;
use App\Models\SofaScorePlayerPosition; use App\Models\SofaScorePlayerPosition;
use App\Models\SofaScoreRosa; use App\Models\SofaScoreRosa;
@@ -599,15 +600,51 @@ class PlayerPropsDrop extends Widget
foreach ($results as $key => $result) { foreach ($results as $key => $result) {
if ((int) $player['id'] == (int) $result['id']) { if ((int) $player['id'] == (int) $result['id']) {
$this->players[$k]['active'] = $result['active']; $this->players[$k]['active'] = $result['active'];
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('gls', '>', $result['asp_player_goals'])->first();
if ($min) {
$this->players[$k]['gls'] = number_format($min->gls, 3);
} else {
$this->players[$k]['gls'] = number_format($result['asp_player_goals'], 3); $this->players[$k]['gls'] = number_format($result['asp_player_goals'], 3);
}
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('fls', '>', $result['asp_player_fouls'])->first();
if ($min) {
$this->players[$k]['fls'] = number_format($min->fls, 3);
} else {
$this->players[$k]['fls'] = number_format($result['asp_player_fouls'], 3); $this->players[$k]['fls'] = number_format($result['asp_player_fouls'], 3);
}
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('ofs', '>', $result['asp_player_offsides'])->first();
if ($min) {
$this->players[$k]['ofs'] = number_format($min->fls, 3);
} else {
$this->players[$k]['ofs'] = number_format($result['asp_player_offsides'], 3); $this->players[$k]['ofs'] = number_format($result['asp_player_offsides'], 3);
}
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('snt', '>', $result['asp_player_shots_on_target'])->first();
if ($min) {
$this->players[$k]['snt'] = number_format($min->fls, 3);
} else {
$this->players[$k]['snt'] = number_format($result['asp_player_total_shots'], 3); $this->players[$k]['snt'] = number_format($result['asp_player_total_shots'], 3);
}
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('tsh', '>', $result['asp_player_total_shots'])->first();
if ($min) {
$this->players[$k]['tsh'] = number_format($min->fls, 3);
} else {
$this->players[$k]['tsh'] = number_format($result['asp_player_shots_on_target'], 3); $this->players[$k]['tsh'] = number_format($result['asp_player_shots_on_target'], 3);
}
$min = ExpectedMinimumPosition::where('position', $this->players[$k]['pos'])->where('crd', '>', $result['asp_player_cards'])->first();
if ($min) {
$this->players[$k]['crd'] = number_format($min->fls, 3);
} else {
$this->players[$k]['crd'] = number_format($result['asp_player_cards'], 3); $this->players[$k]['crd'] = number_format($result['asp_player_cards'], 3);
} }
} }
} }
}
$this->dispatch('update-players', players: $this->players); $this->dispatch('update-players', players: $this->players);
} }
@@ -4,4 +4,4 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class ExpectiveApproach extends Model {} class ExpectedMinimumPosition extends Model {}
@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('expective_approaches', function (Blueprint $table) {
$table->id();
$table->string('position');
$table->decimal('goals', 4, 3)->default(0);
$table->decimal('assists', 4, 3)->default(0);
$table->decimal('cards', 4, 3)->default(0);
$table->decimal('fouls', 4, 3)->default(0);
$table->decimal('was_fould', 4, 3)->default(0);
$table->decimal('offsides', 4, 3)->default(0);
$table->decimal('total_shots', 4, 3)->default(0);
$table->decimal('shots_on_target', 4, 3)->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('expective_approaches');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('expected_minimum_positions', function (Blueprint $table) {
$table->id();
$table->string('position');
$table->decimal('gls', 4, 3)->default(0);
$table->decimal('crd', 4, 3)->default(0);
$table->decimal('fls', 4, 3)->default(0);
$table->decimal('ofs', 4, 3)->default(0);
$table->decimal('tsh', 4, 3)->default(0);
$table->decimal('snt', 4, 3)->default(0);
$table->decimal('wlf', 4, 3)->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('expected_minimum_positions');
}
};
+2 -1
View File
@@ -27,7 +27,8 @@ class DatabaseSeeder extends Seeder
AlarmLevelSeeder::class, AlarmLevelSeeder::class,
OddsNameSeeder::class, OddsNameSeeder::class,
AddByMethodSeeder::class, AddByMethodSeeder::class,
StatistikoConfigSeeder::class StatistikoConfigSeeder::class,
ExpectedMinimumPositionSeeder::class,
]); ]);
} }
} }
@@ -0,0 +1,34 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ExpectedMinimumPositionSeeder extends Seeder
{
public function run(): void
{
/**
* Clients
*/
$sql = "INSERT INTO `expected_minimum_positions` (`id`, `position`, `gls`, `crd`, `fls`, `ofs`, `tsh`, `snt`, `wlf`, `created_at`, `updated_at`)
VALUES
(1, 'ST', 0.1450, 0.1000, 1.3763, 0.5878, 0.8109, 0.5108, 1.5070, NULL, NULL),
(2, 'SS', 0.1000, 0.1000, 1.1887, 0.4055, 0.6931, 0.4055, 1.6784, NULL, NULL),
(3, 'LW', 0.0740, 0.1000, 1.1887, 0.3102, 0.5108, 0.3365, 1.5070, NULL, NULL),
(4, 'RW', 0.0740, 0.1000, 1.1887, 0.3102, 0.5108, 0.3365, 1.5070, NULL, NULL),
(5, 'AM', 0.0740, 0.1000, 1.2730, 0.1823, 0.5108, 0.3365, 1.5070, NULL, NULL),
(6, 'ML', 0.0295, 0.1250, 1.1185, 0.1671, 0.3365, 0.2231, 1.2730, NULL, NULL),
(7, 'MR', 0.0295, 0.1250, 1.1185, 0.1671, 0.3365, 0.2231, 1.2730, NULL, NULL),
(8, 'MC', 0.0405, 0.1450, 1.3765, 0.0690, 0.4055, 0.2877, 1.2730, NULL, NULL),
(9, 'DM', 0.0240, 0.1825, 1.5069, 0.0408, 0.2877, 0.1823, 1.1887, NULL, NULL),
(10, 'DC', 0.0145, 0.2080, 0.9810, 0.0339, 0.2231, 0.1335, 0.6930, NULL, NULL),
(11, 'SW', 0.0035, 0.2080, 0.9807, 0.0339, 0.2231, 0.1335, 0.6933, NULL, NULL),
(12, 'DL', 0.0080, 0.1825, 1.1185, 0.0690, 0.2513, 0.1542, 0.9805, NULL, NULL),
(13, 'DR', 0.0080, 0.1825, 1.1185, 0.0690, 0.2513, 0.1542, 0.9805, NULL, NULL);
";
DB::unprepared($sql);
}
}
@@ -1,34 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ExpectiveApproachSeeder extends Seeder
{
public function run(): void
{
/**
* Clients
*/
$sql = "INSERT INTO `expective_approaches` (`id`, `position`, `goals`, `assists`, `cards`, `fouls`, `was_fould`, `offsides`, `total_shots`, `shots_on_target`, `created_at`, `updated_at`)
VALUES
(1, 'AM', 0.208, 0.165, 0.169, 1.208, 1.485, 0.172, 1.880, 0.676, NULL, NULL),
(2, 'DC', 0.044, 0.028, 0.195, 0.959, 0.665, 0.036, 0.525, 0.263, NULL, NULL),
(3, 'ST', 0.374, 0.129, 0.154, 1.417, 1.397, 0.586, 2.477, 0.930, NULL, NULL),
(4, 'MC', 0.099, 0.104, 0.214, 1.353, 1.257, 0.058, 1.201, 0.474, NULL, NULL),
(5, 'DM', 0.059, 0.071, 0.239, 1.392, 1.144, 0.028, 0.899, 0.382, NULL, NULL),
(6, 'DL', 0.042, 0.093, 0.190, 1.041, 0.976, 0.073, 0.652, 0.285, NULL, NULL),
(7, 'ML', 0.117, 0.137, 0.163, 1.064, 1.214, 0.182, 1.315, 0.493, NULL, NULL),
(8, 'LW', 0.233, 0.176, 0.155, 1.138, 1.553, 0.314, 2.114, 0.745, NULL, NULL),
(9, 'DR', 0.041, 0.086, 0.192, 1.097, 0.986, 0.063, 0.610, 0.271, NULL, NULL),
(10, 'MR', 0.115, 0.130, 0.170, 1.118, 1.207, 0.161, 1.229, 0.471, NULL, NULL),
(11, 'RW', 0.219, 0.184, 0.155, 1.159, 1.468, 0.286, 1.992, 0.709, NULL, NULL),
(12, 'SS', 0.286, 0.183, 0.157, 1.230, 1.634, 0.339, 2.331, 0.849, NULL, NULL),
(13, 'SW', 0.050, 0.027, 0.186, 0.877, 0.624, 0.053, 0.585, 0.306, NULL, NULL);
";
DB::unprepared($sql);
}
}