Skip to content

Commit

Permalink
[TM-1461] check if job is created for fix (#589)
Browse files Browse the repository at this point in the history
* [TM-1461] check if job is created for fix

* [TM-1461] remove comment
  • Loading branch information
egrojMonroy authored Nov 26, 2024
1 parent 4c40156 commit a3e3a81
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ public function clipOverlappingPolygons(Request $request)
$allPolygonUuids = array_merge($allPolygonUuids, $polygonUuids);
}
$uniquePolygonUuids = array_unique($allPolygonUuids);
$delayedJob = null;
if (! empty($uniquePolygonUuids)) {
$user = Auth::user();
$delayedJob = DelayedJob::create();
$job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id);
dispatch($job);
}

return new DelayedJobResource($delayedJob);
if ($delayedJob) {
return new DelayedJobResource($delayedJob);
} else {
return response()->json(['message' => 'No overlapping polygons found or processed.'], 204);
}
}

public function clipOverlappingPolygon(string $uuid)
Expand Down

0 comments on commit a3e3a81

Please sign in to comment.