From a3e3a81952d6f4e69482010bfe200bc88faf62e4 Mon Sep 17 00:00:00 2001 From: Jorge Monroy Date: Tue, 26 Nov 2024 17:11:55 -0400 Subject: [PATCH] [TM-1461] check if job is created for fix (#589) * [TM-1461] check if job is created for fix * [TM-1461] remove comment --- .../V2/Terrafund/TerrafundClipGeometryController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php b/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php index a4ecb766a..2e7d5ead2 100644 --- a/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php +++ b/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php @@ -86,6 +86,7 @@ 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(); @@ -93,7 +94,11 @@ public function clipOverlappingPolygons(Request $request) 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)