|
|
@ -291,6 +291,23 @@ class ProjectController extends Controller |
|
|
|
$builder = $dataBuilder['builder']; |
|
|
|
$builder = $dataBuilder['builder']; |
|
|
|
$countBuilder = $dataBuilder['count']; |
|
|
|
$countBuilder = $dataBuilder['count']; |
|
|
|
$dataGet = $builder->get(); |
|
|
|
$dataGet = $builder->get(); |
|
|
|
|
|
|
|
foreach($dataGet as $p) { |
|
|
|
|
|
|
|
$project = Project::find($p->id); |
|
|
|
|
|
|
|
if (!$project) continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$act = Activity::select('persentase_progress as total_progress') |
|
|
|
|
|
|
|
->where([ |
|
|
|
|
|
|
|
['proyek_id', $p->id], |
|
|
|
|
|
|
|
['parent_id', null] |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
->first(); |
|
|
|
|
|
|
|
if ($act) { |
|
|
|
|
|
|
|
$project->persentase_progress = $act->total_progress; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$project->persentase_progress = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$project->save(); |
|
|
|
|
|
|
|
} |
|
|
|
$totalRecord = $countBuilder->count(); |
|
|
|
$totalRecord = $countBuilder->count(); |
|
|
|
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200); |
|
|
|
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200); |
|
|
|
} |
|
|
|
} |
|
|
|