wip double
This commit is contained in:
1 parent
987d096928
commit
c4569196ea
6 files changed
+112
-37
No files matched your search
@@ -42,9 +42,15 @@ class Grapper
|
||||
* empty grapping folder
|
||||
* empty mailing text
|
||||
*/
|
||||
if ($debug)
|
||||
Notice::note('File clean directory', 'b');
|
||||
|
||||
File::cleanDirectory(Sofascore::$storage);
|
||||
|
||||
SofaScoreEventGrapped::query()->update(['in_current_grapper' => false]);
|
||||
if ($debug)
|
||||
Notice::note('Truncate SofaScoreEventGrapped', 'b');
|
||||
|
||||
SofaScoreEventGrapped::query()->truncate();
|
||||
|
||||
foreach ($active_tournaments as $tournament) {
|
||||
|
||||
|
||||
+6
@@ -16,6 +16,12 @@ class ListStatistikoEvents extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('download')
|
||||
->icon('phosphor-download')
|
||||
->color('gray'),
|
||||
Action::make('double')
|
||||
->icon('phosphor-funnel')
|
||||
->color('gray'),
|
||||
Action::make('truncate')
|
||||
->icon('phosphor-trash')
|
||||
->requiresConfirmation()
|
||||
|
||||
+88
-21
@@ -2,14 +2,22 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables;
|
||||
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Sport;
|
||||
use App\Models\StatistikoEvent;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class StatistikoEventsTable
|
||||
{
|
||||
@@ -21,15 +29,16 @@ class StatistikoEventsTable
|
||||
->columns([
|
||||
IconColumn::make('sport_id')
|
||||
->label('')
|
||||
->icon(fn (string $state): string => match ($state) {
|
||||
->icon(fn(string $state): string => match ($state) {
|
||||
'1' => 'icon-soccerball',
|
||||
}),
|
||||
TextColumn::make('match_id'),
|
||||
TextColumn::make('match_id')
|
||||
->sortable(),
|
||||
TextColumn::make('league.name')
|
||||
->searchable()
|
||||
->copyable()
|
||||
->copyMessage('Liga name copied')
|
||||
->description(fn ($record) => ucwords($record->league?->country->name))
|
||||
->description(fn($record) => ucwords($record->league?->country->name))
|
||||
->copyMessageDuration(1500),
|
||||
TextColumn::make('home.name')
|
||||
->searchable()
|
||||
@@ -45,26 +54,84 @@ class StatistikoEventsTable
|
||||
|
||||
])
|
||||
->filters([
|
||||
// when we do another sport make all filter depending on sport
|
||||
// SelectFilter::make('sport_id')
|
||||
// ->options(fn () => Sport::getSportForClient(auth()->user()->client_id))
|
||||
// ->label('Sport'),
|
||||
SelectFilter::make('league_id')
|
||||
->relationship('league', 'name')
|
||||
->searchable()
|
||||
->label('League'),
|
||||
SelectFilter::make('home_id')
|
||||
->relationship('home', 'name')
|
||||
->searchable()
|
||||
->label('Home'),
|
||||
SelectFilter::make('away_id')
|
||||
->relationship('away', 'name')
|
||||
->searchable()
|
||||
->label('Away'),
|
||||
Filter::make('event_filters')
|
||||
->columns(5)->columnSpan(5)
|
||||
->schema([
|
||||
Select::make('sport_id')
|
||||
->default(1)
|
||||
->options(fn() => Sport::query()->where('is_active', 1)->pluck('name', 'id'))
|
||||
->selectablePlaceholder(false)
|
||||
->label('Sport')
|
||||
->live(),
|
||||
Select::make('league_id')
|
||||
->options(function (Get $get) {
|
||||
if ($get('sport_id')) {
|
||||
$leagues = StatistikoEvent::where('sport_id', $get('sport_id'))->groupBy('league_id')->pluck('league_id')->toArray();
|
||||
if ($leagues)
|
||||
return CompetitionGroup::query()->whereIn('id', $leagues)->orderBy('name')->pluck('name', 'id');
|
||||
}
|
||||
})
|
||||
->preload()
|
||||
->searchable()
|
||||
->label('League'),
|
||||
Select::make('home_id')
|
||||
->relationship('home', 'name')
|
||||
->searchable()
|
||||
->label('Home'),
|
||||
Select::make('away_id')
|
||||
->relationship('away', 'name')
|
||||
->searchable()
|
||||
->label('Away'),
|
||||
Checkbox::make('find_double'),
|
||||
])->query(function (Builder $query, array $data): Builder {
|
||||
return $query->when(
|
||||
$data['find_double'],
|
||||
function (Builder $query) use ($data) {
|
||||
if (!$data['sport_id']) {
|
||||
$data['sport_id'] = 1;
|
||||
}
|
||||
$events = StatistikoEvent::where('sport_id', (int) $data['sport_id'])->pluck('match_id')->toArray();
|
||||
$doublEvents = array_diff_assoc(
|
||||
$events,
|
||||
array_unique($events)
|
||||
);
|
||||
$query->whereIn('match_id', $doublEvents)->orderBy('match_id');
|
||||
}
|
||||
)->when(
|
||||
$data['sport_id'],
|
||||
function (Builder $query, $sport_id) {
|
||||
$query->where('sport_id', (int) $sport_id);
|
||||
}
|
||||
)->when(
|
||||
$data['league_id'],
|
||||
function (Builder $query, $league_id) {
|
||||
$query->where('league_id', (int) $league_id);
|
||||
}
|
||||
)->when(
|
||||
$data['home_id'],
|
||||
function (Builder $query, $home_id) {
|
||||
$query->where('home_id', (int) $home_id);
|
||||
}
|
||||
)->when(
|
||||
$data['away_id'],
|
||||
function (Builder $query, $away_id) {
|
||||
$query->where('away_id', (int) $away_id);
|
||||
}
|
||||
);
|
||||
})->indicateUsing(function (array $data): ?string {
|
||||
if (! $data['find_double']) {
|
||||
return null;
|
||||
}
|
||||
return 'Find Double';
|
||||
}),
|
||||
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->filtersFormColumns(5)
|
||||
->persistFiltersInSession()
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
|
||||
@@ -42,6 +42,5 @@ class Sport extends Model
|
||||
$sports = Client::where('id', $client_id)->value('sport');
|
||||
|
||||
return Sport::query()->whereIn('id', $sports)->pluck('name', 'id');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -43,12 +43,9 @@ class StatistikoEvent extends Model
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'starttime' => 'datetime',
|
||||
];
|
||||
}
|
||||
protected $casts = [
|
||||
'starttime' => 'datetime',
|
||||
];
|
||||
|
||||
public function sport(): BelongsTo
|
||||
{
|
||||
|
||||
+8
-8
@@ -17,17 +17,17 @@ case "$1" in
|
||||
|
||||
echo "\n⚽ sofa_score_task $1"
|
||||
|
||||
echo "\n⚽ close all vpn"
|
||||
killall ssh
|
||||
# echo "\n⚽ close all vpn"
|
||||
# killall ssh
|
||||
|
||||
echo "\n⚽ open vpn"
|
||||
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
|
||||
# echo "\n⚽ open vpn"
|
||||
# ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
|
||||
|
||||
echo "\n⚽ Settings To Local"
|
||||
php artisan nuh --d --f 67 --fun=2 --task=$1
|
||||
# echo "\n⚽ Settings To Local"
|
||||
# php artisan nuh --d --f 67 --fun=2 --task=$1
|
||||
|
||||
echo "\n⚽ close vpn"
|
||||
killall ssh
|
||||
# echo "\n⚽ close vpn"
|
||||
# killall ssh
|
||||
|
||||
# echo "\n⚽ TaskConfig start"
|
||||
# php artisan nuh --d --f 67 --fun=3 --task=$1
|
||||
|
||||
Reference in new issue
Block a user