From 0ae702ebe5baa2285b68a0f48753d3b5a15cee96 Mon Sep 17 00:00:00 2001 From: wahyu Date: Fri, 13 Oct 2023 14:44:28 +0700 Subject: [PATCH] fix update status --- .../Controllers/ReportActivityMaterialController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index d84c4fa..e451129 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -70,6 +70,17 @@ class ReportActivityMaterialController extends Controller "persentase_progress" => $sumReportActivityMaterial/$sumAssignMaterial*100, "updated_by" => $this->currentName ); + if ($sumReportActivityMaterial > 0) { + $data = []; + $reportActivityMaterial = ReportActivityMaterial::where('activity_id', $request->activity_id)->get(); + foreach ($reportActivityMaterial as $value) { + $data[] = $value; + } + $actualStartValues = array_column(array_filter($data, function($item) { + return isset($item['report_date']); + }), 'report_date'); + $dataUpdate["actual_start"] = min($actualStartValues); + } Activity::where('id', $request->activity_id)->update($dataUpdate); }