Browse Source

Merge pull request 'Adjusting s curve' (#100) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#100
pull/3/head
ibnu 1 year ago
parent
commit
76d479cf6d
  1. 11
      app/Helpers/MasterFunctionsHelper.php

11
app/Helpers/MasterFunctionsHelper.php

@ -111,23 +111,26 @@ class MasterFunctionsHelper {
$dates = iterator_to_array($period); $dates = iterator_to_array($period);
$count = count($dates); $count = count($dates);
$avgProgress = $ttlProgress/$count; $avgProgress = $ttlProgress/$ttlPlanning/$count*100;
$avgPlanning = $ttlPlanning/$count; $avgPlanning = $ttlPlanning/$ttlPlanning/$count*100;
$progressData = []; $progressData = [];
$planningData = []; $planningData = [];
$dates = [];
$tempProgress = 0; $tempProgress = 0;
$tempPlanning = 0; $tempPlanning = 0;
foreach($period as $p){ foreach($period as $p){
array_push($progressData, $tempProgress); array_push($progressData, $tempProgress);
array_push($planningData, $tempPlanning); array_push($planningData, $tempPlanning);
array_push($dates, $p->format("Y-m-d"));
$tempProgress += $avgProgress; $tempProgress += $avgProgress;
$tempPlanning += $avgPlanning; $tempPlanning += $avgPlanning;
} }
$dataResponse = array( $dataResponse = array(
"percentagePlan" => $progressData, "percentagePlan" => $planningData,
"percentageReal" => $planningData, "percentageReal" => $progressData,
"date" => $dates,
); );
$dataFinal[] = array( $dataFinal[] = array(

Loading…
Cancel
Save