Skip to content

Commit

Permalink
Merge pull request #2 from justbetter/feature/only-update-open
Browse files Browse the repository at this point in the history
Also update where the operation status is still null
  • Loading branch information
VincentBean authored Aug 27, 2024
2 parents d938910 + 5e05a9a commit c6b43fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Actions/UpdateBulkStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public function update(): void
{
BulkRequest::query()
->whereHas('operations', function (Builder $query): void {
$query->where('status', '=', OperationStatus::Open);
$query
->where('status', '=', OperationStatus::Open)
->orWhereNull('status');
})
->get()
->each(fn (BulkRequest $bulkRequest): PendingDispatch => UpdateBulkStatusJob::dispatch($bulkRequest));
Expand Down
2 changes: 1 addition & 1 deletion tests/Actions/UpdateBulkStatusesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function it_can_update_bulk_statuses(): void

$status2->operations()->create([
'operation_id' => 1,
'status' => OperationStatus::Open,
'status' => null,
]);

$status3->operations()->create([
Expand Down

0 comments on commit c6b43fd

Please sign in to comment.