Browse Source

[Fix] Command ActualProgressProject: project multi jika ada gantt tetapi tidak ada hierarcy tidak dihitung

pull/13/head
Fuad Hadisurya 5 months ago
parent
commit
6c44a2ce16
  1. 7
      app/Console/Commands/ActualProgressProject.php

7
app/Console/Commands/ActualProgressProject.php

@ -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 {

Loading…
Cancel
Save