Skip to content

Commit 0e93969

Browse files
committed
fixes dump rejected chunk index
1 parent aa8509d commit 0e93969

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/app/Jobs/ChunkImportJob.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ChunkImportJob implements ShouldQueue
2424
private $params;
2525
private $sheetName;
2626
private $chunk;
27+
private $index;
2728

2829
public $queue;
2930

@@ -35,6 +36,7 @@ public function __construct(DataImport $dataImport, Template $template, User $us
3536
$this->params = $params;
3637
$this->sheetName = $sheetName;
3738
$this->chunk = $chunk;
39+
$this->index = $dataImport->chunks;
3840

3941
$this->queue = $template->queue();
4042
}
@@ -47,7 +49,8 @@ public function handle()
4749
$this->user,
4850
$this->params,
4951
$this->sheetName,
50-
$this->chunk
52+
$this->chunk,
53+
$this->index
5154
))->run();
5255
}
5356
}

src/app/Services/Importers/Chunk.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ class Chunk
2626
private $params;
2727
private $sheetName;
2828
private $chunk;
29+
private $index;
2930
private $rejected;
3031
private $errorColumn;
3132
private $validator;
3233
private $importer;
3334

34-
public function __construct(DataImport $dataImport, Template $template, User $user, Obj $params, string $sheetName, Collection $chunk)
35+
public function __construct(DataImport $dataImport, Template $template, User $user, Obj $params, string $sheetName, Collection $chunk, int $index)
3536
{
3637
$this->dataImport = $dataImport;
3738
$this->template = $template;
3839
$this->user = $user;
3940
$this->params = $params;
4041
$this->sheetName = $sheetName;
4142
$this->chunk = $chunk;
43+
$this->index = $index;
4244
$this->rejected = collect();
4345
$this->errorColumn = config('enso.imports.errorColumn');
4446
$this->importer = $this->template->importer($sheetName);
@@ -107,7 +109,8 @@ private function dumpRejected()
107109
(new RejectedDump(
108110
$this->dataImport,
109111
$this->sheetName,
110-
$this->rejected
112+
$this->rejected,
113+
$this->index
111114
))->handle();
112115
}
113116

src/app/Services/Writer/RejectedDump.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ class RejectedDump
1010
private $dataImport;
1111
private $sheetName;
1212
private $rejected;
13+
private $index;
1314
private $dump;
1415

15-
public function __construct(DataImport $dataImport, string $sheetName, Collection $rejected)
16+
public function __construct(DataImport $dataImport, string $sheetName, Collection $rejected, int $index)
1617
{
1718
$this->dataImport = $dataImport;
1819
$this->sheetName = $sheetName;
1920
$this->rejected = $rejected;
21+
$this->index = $index;
2022
$this->dump = collect();
2123
}
2224

@@ -53,6 +55,6 @@ private function path()
5355
{
5456
return $this->dataImport->rejectedFolder()
5557
.DIRECTORY_SEPARATOR
56-
.'rejected_dump_'.$this->dataImport->chunks.'.json';
58+
.'rejected_dump_'.$this->index.'.json';
5759
}
5860
}

0 commit comments

Comments
 (0)