From 8546473146d9a9caeb16a5b878bee23d83575bd0 Mon Sep 17 00:00:00 2001 From: JORGE Date: Tue, 26 Nov 2024 16:12:30 -0400 Subject: [PATCH 1/2] [TM-1461] check if job is created for fix --- .../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..42a2bb0b5 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); // No content + } } public function clipOverlappingPolygon(string $uuid) From fe50c3a7d32a0c80219adf9f69f3dda22697739f Mon Sep 17 00:00:00 2001 From: JORGE Date: Tue, 26 Nov 2024 16:14:20 -0400 Subject: [PATCH 2/2] [TM-1461] remove comment --- .../V2/Terrafund/TerrafundClipGeometryController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php b/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php index 42a2bb0b5..2e7d5ead2 100644 --- a/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php +++ b/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php @@ -97,7 +97,7 @@ public function clipOverlappingPolygons(Request $request) if ($delayedJob) { return new DelayedJobResource($delayedJob); } else { - return response()->json(['message' => 'No overlapping polygons found or processed.'], 204); // No content + return response()->json(['message' => 'No overlapping polygons found or processed.'], 204); } }