From e644cb4782ad3815bd25cc42d84d3929895307d7 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 3 Jul 2023 12:42:01 +0700 Subject: [PATCH] Adjusting s curve --- app/Helpers/MasterFunctionsHelper.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 49877be..1a07007 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -111,23 +111,26 @@ class MasterFunctionsHelper { $dates = iterator_to_array($period); $count = count($dates); - $avgProgress = $ttlProgress/$count; - $avgPlanning = $ttlPlanning/$count; + $avgProgress = $ttlProgress/$ttlPlanning/$count*100; + $avgPlanning = $ttlPlanning/$ttlPlanning/$count*100; $progressData = []; $planningData = []; + $dates = []; $tempProgress = 0; $tempPlanning = 0; foreach($period as $p){ array_push($progressData, $tempProgress); array_push($planningData, $tempPlanning); + array_push($dates, $p->format("Y-m-d")); $tempProgress += $avgProgress; $tempPlanning += $avgPlanning; } $dataResponse = array( - "percentagePlan" => $progressData, - "percentageReal" => $planningData, + "percentagePlan" => $planningData, + "percentageReal" => $progressData, + "date" => $dates, ); $dataFinal[] = array(