chore: cleanup dead code + format with Pint
- Remove unused FeaturesController (empty stubs, no routes) - Remove ConvertSpatialFile CLI command (unused; service used in LayerManager) - Remove MigrateGeojsonToFeatures CLI command (one-shot migration, not referenced) - Remove .claude/worktrees/ (11 old agent worktrees from June) - Apply Laravel Pint formatting across 219 files (style only, no functional changes) Tests: 101 passing (319 assertions) API routes: unchanged (8 routes intact)
This commit is contained in:
+28
-26
@@ -2,14 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\LogsActivity;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Traits\LogsActivity;
|
||||
|
||||
class Feature extends Model
|
||||
{
|
||||
use SoftDeletes, LogsActivity;
|
||||
use LogsActivity, SoftDeletes;
|
||||
|
||||
const STATUSES = ['planned', 'started', 'in_progress', 'completed', 'verified'];
|
||||
|
||||
@@ -22,15 +23,15 @@ class Feature extends Model
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'geometry' => 'array',
|
||||
'properties' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
'planned_start' => 'date',
|
||||
'planned_end' => 'date',
|
||||
'actual_start' => 'date',
|
||||
'actual_end' => 'date',
|
||||
'baseline_start' => 'date',
|
||||
'baseline_end' => 'date',
|
||||
'geometry' => 'array',
|
||||
'properties' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
'planned_start' => 'date',
|
||||
'planned_end' => 'date',
|
||||
'actual_start' => 'date',
|
||||
'actual_end' => 'date',
|
||||
'baseline_start' => 'date',
|
||||
'baseline_end' => 'date',
|
||||
];
|
||||
|
||||
public function featureType()
|
||||
@@ -80,13 +81,13 @@ class Feature extends Model
|
||||
|
||||
public function getStatusColorAttribute(): string
|
||||
{
|
||||
return match($this->status) {
|
||||
'planned' => '#6b7280',
|
||||
'started' => '#3b82f6',
|
||||
return match ($this->status) {
|
||||
'planned' => '#6b7280',
|
||||
'started' => '#3b82f6',
|
||||
'in_progress' => '#f59e0b',
|
||||
'completed' => '#10b981',
|
||||
'verified' => '#8b5cf6',
|
||||
default => '#6b7280',
|
||||
'completed' => '#10b981',
|
||||
'verified' => '#8b5cf6',
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ class Feature extends Model
|
||||
return null;
|
||||
}
|
||||
$end = $this->actual_end ?? now()->toDateString();
|
||||
|
||||
|
||||
return $this->planned_end->diffInDays($end, false);
|
||||
}
|
||||
|
||||
@@ -109,28 +110,28 @@ class Feature extends Model
|
||||
return null;
|
||||
}
|
||||
$start = $this->actual_start ?? now()->toDateString();
|
||||
|
||||
|
||||
return $this->planned_start->diffInDays($start, false);
|
||||
}
|
||||
|
||||
public function getPlannedProgressAtAttribute(?\Carbon\Carbon $date = null): float
|
||||
public function getPlannedProgressAtAttribute(?Carbon $date = null): float
|
||||
{
|
||||
$date = $date ?? now();
|
||||
|
||||
|
||||
if (! $this->planned_start || ! $this->planned_end) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if ($date <= $this->planned_start) {
|
||||
return 0;
|
||||
}
|
||||
if ($date >= $this->planned_end) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
|
||||
$totalDays = $this->planned_start->diffInDays($this->planned_end);
|
||||
$elapsedDays = $this->planned_start->diffInDays($date);
|
||||
|
||||
|
||||
return round(($elapsedDays / $totalDays) * 100, 2);
|
||||
}
|
||||
|
||||
@@ -138,11 +139,11 @@ class Feature extends Model
|
||||
{
|
||||
$pv = $this->planned_progress_at;
|
||||
$ev = $this->progress;
|
||||
|
||||
|
||||
if ($pv <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return round($ev / $pv, 2);
|
||||
}
|
||||
|
||||
@@ -152,6 +153,7 @@ class Feature extends Model
|
||||
if ($spi === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $spi >= 0.95;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user