test download all

This commit is contained in:
salam committed 2026-10-29 15:02:15 +01:00
1 parent 20e93ba014
commit 113dbad806
2 files changed
+15 -12

No files matched your search

@@ -25,38 +25,40 @@ class ListStatistikoPlayers extends ListRecords
->label('Download') ->label('Download')
->icon('phosphor-download') ->icon('phosphor-download')
->columnMapping(false) ->columnMapping(false)
->chunkSize(500) ->chunkSize(1000)
->exporter(StatistikoPlayerExporter::class) ->exporter(StatistikoPlayerExporter::class)
->fileName(function (Export $export): string { ->fileName(function (Export $export): string {
$options = $export->getOptions(); $options = $export->getOptions();
switch ($options['limit']) { switch ($options['limit']) {
case 1: case '1':
return 'player-history-0-200k-'.date('d.m.Y-H.i'); return 'player-history-0-200k-'.date('d.m.Y-H.i');
case 2: case '2':
return 'player-history-200k-400k-'.date('d.m.Y-H.i'); return 'player-history-200k-400k-'.date('d.m.Y-H.i');
case 3: case '3':
return 'player-history-400k-600k-'.date('d.m.Y-H.i'); return 'player-history-400k-600k-'.date('d.m.Y-H.i');
case 4: case '4':
return 'player-history-600k-800k-'.date('d.m.Y-H.i'); return 'player-history-600k-800k-'.date('d.m.Y-H.i');
case 5: case '5':
return 'player-history-800k-1000k-'.date('d.m.Y-H.i'); return 'player-history-800k-1000k-'.date('d.m.Y-H.i');
default: default:
return 'generic'; return 'player-history-all-'.date('d.m.Y-H.i');
} }
}) })
->modifyQueryUsing(function (Builder $query, array $options) { ->modifyQueryUsing(function (Builder $query, array $options) {
if (isset($options['limit'])) { if (isset($options['limit'])) {
switch ($options['limit']) { switch ($options['limit']) {
case 1: case '1':
return $query->skip(0)->take(200000); return $query->skip(0)->take(200000);
case 2: case '2':
return $query->skip(200000)->take(200000); return $query->skip(200000)->take(200000);
case 3: case '3':
return $query->skip(400000)->take(200000); return $query->skip(400000)->take(200000);
case 4: case '4':
return $query->skip(600000)->take(200000); return $query->skip(600000)->take(200000);
case 5: case '5':
return $query->skip(800000)->take(200000); return $query->skip(800000)->take(200000);
default:
return;
} }
} }
@@ -19,6 +19,7 @@ class StatistikoPlayerExporter extends Exporter
Select::make('limit') Select::make('limit')
->label('Pakets for export') ->label('Pakets for export')
->options([ ->options([
'all' => 'all',
'1' => '0 - 200k', '1' => '0 - 200k',
'2' => '200k - 400k', '2' => '200k - 400k',
'3' => '400k - 600k', '3' => '400k - 600k',