Skip to content

Commit

Permalink
[TM-1467] add filter to get only active polygons in command
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarLima1 committed Dec 19, 2024
1 parent a7f9ad3 commit f6ecf94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Console/Commands/RecalculatePolygonAreas.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class RecalculatePolygonAreas extends Command
* @var string
*/
protected $signature = 'polygons:recalculate-areas
{--batch-size=100 : Number of records to process in each batch}';
{--batch-size=100 : Number of records to process in each batch}
{--only-active : Process only active polygons}';

/**
* The console command description.
Expand All @@ -33,7 +34,13 @@ public function handle(AreaCalculationService $areaService)
DB::beginTransaction();

try {
$sitePolygons = SitePolygon::query()->cursor();
$query = SitePolygon::query();

if ($this->option('only-active')) {
$query->active();
}

$sitePolygons = $query->cursor();

$processedCount = 0;
$errorCount = 0;
Expand Down

0 comments on commit f6ecf94

Please sign in to comment.