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