|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
namespace App\Console\Commands; |
|
|
|
|
|
|
|
|
|
use App\Helpers\MasterFunctionsHelper; |
|
|
|
|
use App\Models\HierarchyFtth; |
|
|
|
|
use App\Models\Project; |
|
|
|
|
use App\Models\VersionGantt; |
|
|
|
|
use Illuminate\Console\Command; |
|
|
|
@ -53,8 +54,14 @@ class ActualProgressProject extends Command
|
|
|
|
|
->where('m_version_gantt.proyek_id', $project->id) |
|
|
|
|
->get(); |
|
|
|
|
foreach ($versionGantt as $key => $gantt) { |
|
|
|
|
$hierarchy = HierarchyFtth::where('id',$gantt->hierarchy_ftth_id)->count(); |
|
|
|
|
// Perhitungan jika project memiliki gantt tetapi tidak ada hierarchy (Kasus perpindahan tipe project dari single location ke multi location) |
|
|
|
|
if($hierarchy == 0){ |
|
|
|
|
$progress[$key] = 0; |
|
|
|
|
} else { |
|
|
|
|
$progress[$key] = $gantt->progress; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$actualProgress = round(array_sum($progress) / count($versionGantt), 2); |
|
|
|
|
$progress = array(); // unset/kosongkan array progress untuk project selanjutnya |
|
|
|
|
} else { |
|
|
|
|