diff --git a/app/Helpers/GeometryHelper.php b/app/Helpers/GeometryHelper.php index 97ea5bfc..c0ca8e1e 100755 --- a/app/Helpers/GeometryHelper.php +++ b/app/Helpers/GeometryHelper.php @@ -5,7 +5,6 @@ use App\Models\V2\PolygonGeometry; use App\Models\V2\Projects\Project; use App\Models\V2\Projects\ProjectPolygon; -use App\Models\V2\Sites\CriteriaSite; use App\Models\V2\Sites\Site; use App\Models\V2\Sites\SitePolygon; use Exception; @@ -134,7 +133,6 @@ public static function getCriteriaDataForPolygonGeometry($polygonGeometry) 'extra_info', ]); } - public static function groupFeaturesBySiteId($geojson) { diff --git a/app/Models/V2/Sites/CriteriaSite.php b/app/Models/V2/Sites/CriteriaSite.php index 62597e30..179992ff 100644 --- a/app/Models/V2/Sites/CriteriaSite.php +++ b/app/Models/V2/Sites/CriteriaSite.php @@ -4,7 +4,6 @@ use App\Models\Traits\HasUuid; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\SoftDeletes; class CriteriaSite extends Model { diff --git a/app/Models/V2/Sites/CriteriaSiteHistoric.php b/app/Models/V2/Sites/CriteriaSiteHistoric.php index 77e095cc..255a0ebf 100644 --- a/app/Models/V2/Sites/CriteriaSiteHistoric.php +++ b/app/Models/V2/Sites/CriteriaSiteHistoric.php @@ -25,7 +25,7 @@ class CriteriaSiteHistoric extends Model 'criteria_id', 'polygon_id', 'valid', - 'extra_info' + 'extra_info', ]; /** diff --git a/app/Services/PolygonService.php b/app/Services/PolygonService.php index f314e670..c6712bb7 100755 --- a/app/Services/PolygonService.php +++ b/app/Services/PolygonService.php @@ -227,7 +227,7 @@ public function createCriteriaSite($polygonId, $criteriaId, $valid, $extraInfo = $existingCriteriaSite = CriteriaSite::where('polygon_id', $polygonId) ->where('criteria_id', $criteriaId) ->first(); - + if ($existingCriteriaSite) { CriteriaSiteHistoric::create([ 'polygon_id' => $existingCriteriaSite->polygon_id, @@ -237,23 +237,22 @@ public function createCriteriaSite($polygonId, $criteriaId, $valid, $extraInfo = 'created_at' => $existingCriteriaSite->created_at, 'updated_at' => $existingCriteriaSite->updated_at, ]); - + $existingCriteriaSite->delete(); } - + $criteriaSite = new CriteriaSite(); $criteriaSite->polygon_id = $polygonId; $criteriaSite->criteria_id = $criteriaId; $criteriaSite->valid = $valid; $criteriaSite->extra_info = $extraInfo ? json_encode($extraInfo) : null; $criteriaSite->save(); - + return true; } catch (\Exception $e) { return $e->getMessage(); } } - /** * Note: At this time, this method assumes that the geometry is a single polygon.