From 391507dedbf4fecf9c9c7ab62f3181455e243ca1 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 7 Jul 2023 15:13:17 +0700 Subject: [PATCH] fix dashboard --- app/Http/Controllers/DashboardBoDController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 8e851cb..9c48541 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -10,6 +10,7 @@ use App\Models\User; use App\Models\UserToVersionGantt; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; class DashboardBoDController extends Controller { @@ -130,8 +131,10 @@ class DashboardBoDController extends Controller $project->scurve = MasterFunctionsHelper::getSCurve($project->id); $selisihProgress = 0; if($project->scurve && $project->scurve[0]){ - $planningProgress = $project->scurve[0]['data']['percentagePlan'][count($project->scurve[0]['data']['percentagePlan'])-1]; - $actualProgress = $project->scurve[0]['data']['percentageReal'][count($project->scurve[0]['data']['percentageReal'])-1]; + $planningArray = $project->scurve[0]['data']['percentagePlan']; + $actualArray = $project->scurve[0]['data']['percentageReal']; + $planningProgress = !empty($planningArray) ? $planningArray[count($planningArray) - 1] : 0; + $actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0; } $selisihProgress = $planningProgress - $actualProgress; try {