From 1fbb8ea2b014fef2565f2755246f9466c9e9290c Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 10 Oct 2023 15:41:39 +0700 Subject: [PATCH] fix update schedule --- app/Http/Controllers/ActivityController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 50ba368..e36ec6c 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -431,11 +431,12 @@ class ActivityController extends Controller $duration = MasterFunctionsHelper::countDays($ganttId, $plannedStart, $plannedEnd); if ($today >= $endDate) { $endDate = $today; - $rerataBobot = $duration > 0 ? $activity->bobot_planning / $duration : 0; - $bobotActual = $activity->progress * $activity->bobot_planning; - $sisaBobot = $activity->bobot_planning - $bobotActual; + $bobotPlanning = (int) $activity->bobot_planning; + $rerataBobot = $duration > 0 ? $bobotPlanning / $duration : 0; + $bobotActual = (int) $activity->persentase_progress/100 * $bobotPlanning; + $sisaBobot = $bobotPlanning - $bobotActual; $sisaHari = $rerataBobot > 0 ? $sisaBobot / $rerataBobot : 0; - $endDate->modify("+".$sisaHari." Days"); + $endDate->modify("+".ceil($sisaHari)." Days"); $actualDuration = MasterFunctionsHelper::countDays($ganttId, $startDate, $endDate); $activity->duration = $actualDuration; $activity->end_date = $endDate;