wip average all bettype in boxes
This commit is contained in:
1 parent
1a46e5d887
commit
fe4fa6e9cf
16 files changed
+1010
-135
No files matched your search
@@ -3,7 +3,6 @@
|
||||
namespace App\Filament\Pages\Selections;
|
||||
|
||||
use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||
use App\Models\SofaScorePlayerCache;
|
||||
use App\Models\SofaScorePlayerPerSeason;
|
||||
use App\Models\StatistikoEvent;
|
||||
|
||||
@@ -13,11 +12,11 @@ class LoadPlayerSelection
|
||||
{
|
||||
$season = GetSeason::load($season, $seasonmode);
|
||||
|
||||
$hash = hash('crc32', $team_id.$team_position.$sofascore_category_id.serialize($season));
|
||||
$cached_players = SofaScorePlayerCache::where('hash', $hash)->value('players');
|
||||
if ($cached_players) {
|
||||
return $cached_players;
|
||||
}
|
||||
// $hash = hash('crc32', $team_id.$team_position.$sofascore_category_id.serialize($season));
|
||||
// $cached_players = SofaScorePlayerCache::where('hash', $hash)->value('players');
|
||||
// if ($cached_players) {
|
||||
// return $cached_players;
|
||||
// }
|
||||
|
||||
$matches = StatistikoEvent::whereIn('season', $season)
|
||||
->where(function ($query) use ($team_id, $team_position) {
|
||||
@@ -92,25 +91,28 @@ class LoadPlayerSelection
|
||||
$position = 'NO SPECIFIC POSITION';
|
||||
}
|
||||
|
||||
$infostring = $events_played.' Ev';
|
||||
if ($val['preferred_foot']) {
|
||||
$infostring .= ' - '.$val['preferred_foot'];
|
||||
}
|
||||
if ($events_played) {
|
||||
$infostring .= ' - '.round($minues_played / $events_played).'min';
|
||||
}
|
||||
$infostring = '';
|
||||
|
||||
if ($colorlevel > 1 && $events_played < $colorlevel) {
|
||||
$result[$position][$player_id] = '<span class="text-red-600 dark:text-red-500 cursor-pointer"><b>'.$val['player_name'].'</b> '.$position.'<br>'.$infostring.'</span>';
|
||||
$infostring = '<div class="w-full text-red-600 dark:text-red-500 cursor-pointer flex flex-row gap-3">';
|
||||
} elseif ($events_played < $colorlevel * 2) {
|
||||
$result[$position][$player_id] = '<span class="text-blue-600 dark:text-blue-500 cursor-pointer"><b>'.$val['player_name'].'</b> '.$position.'<br>'.$infostring.'</span>';
|
||||
$infostring = '<div class="w-full text-blue-600 dark:text-blue-500 cursor-pointer flex flex-row gap-3">';
|
||||
} else {
|
||||
$result[$position][$player_id] = '<span class="text-green-600 dark:text-green-500 cursor-pointer"><b>'.$val['player_name'].'</b> '.$position.'<br>'.$infostring.'</span>';
|
||||
$infostring = '<div class="w-full text-green-600 dark:text-green-500 cursor-pointer flex flex-row gap-3">';
|
||||
}
|
||||
$infostring .= '<div class="flex-1 font-bold">'.$val['player_name'].' '.$val['player_position'].'</div>';
|
||||
$infostring .= '<div>'.$events_played.' Events,</div>';
|
||||
$infostring .= '<div>'.$val['preferred_foot'].' foot,</div>';
|
||||
if ($events_played) {
|
||||
$infostring .= '<div>Av. on field '.round($minues_played / $events_played).'min</div>';
|
||||
}
|
||||
$infostring .= '</div>';
|
||||
$result[$position][$player_id] = $infostring;
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
SofaScorePlayerCache::updateOrCreate(['hash' => $hash], ['players' => $result]);
|
||||
}
|
||||
// if ($result) {
|
||||
// SofaScorePlayerCache::updateOrCreate(['hash' => $hash], ['players' => $result]);
|
||||
// }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user