Skip to content

Commit

Permalink
[TM-1503] lint
Browse files Browse the repository at this point in the history
  • Loading branch information
egrojMonroy committed Nov 25, 2024
1 parent fb41632 commit f13cbad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 0 additions & 2 deletions app/Helpers/GeometryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -134,7 +133,6 @@ public static function getCriteriaDataForPolygonGeometry($polygonGeometry)
'extra_info',
]);
}


public static function groupFeaturesBySiteId($geojson)
{
Expand Down
1 change: 0 additions & 1 deletion app/Models/V2/Sites/CriteriaSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Models\Traits\HasUuid;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CriteriaSite extends Model
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/V2/Sites/CriteriaSiteHistoric.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CriteriaSiteHistoric extends Model
'criteria_id',
'polygon_id',
'valid',
'extra_info'
'extra_info',
];

/**
Expand Down
9 changes: 4 additions & 5 deletions app/Services/PolygonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand Down

0 comments on commit f13cbad

Please sign in to comment.