Browse Source

Merge pull request 'Fix s curve calculation' (#88) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#88
pull/3/head
ibnu 1 year ago
parent
commit
090403eef7
  1. 5
      app/Helpers/MasterFunctionsHelper.php
  2. 1
      app/Http/Controllers/ActivityController.php

5
app/Helpers/MasterFunctionsHelper.php

@ -246,6 +246,9 @@ class MasterFunctionsHelper {
->where('activity_id', '=', $keyActualM->activity_id)
->groupBy('activity_id')
->first();
$sumReportActual = DB::table('report_activity_material')
->where('activity_id', $keyActualM->activity_id)
->sum('qty');
$reportCount = DB::table('report_activity_material')->where('activity_id', '=', $keyActualM->activity_id)->count();
$dataTempReport [$w]['activity_id'] = $keyActualM->activity_id;
$dataTempReport [$w]['qty'] = $keyActualM->qty;
@ -269,7 +272,7 @@ class MasterFunctionsHelper {
$sumPercentageActual+=$keyActualM->bobot_planning/$reportCount;
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
}else{
if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){
if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1 || (int)$sumVolActual->ttl_qty_plan == (int)$sumReportActual){
$sumPercentageActual+=(($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning)*(95/100);
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
}else{

1
app/Http/Controllers/ActivityController.php

@ -467,6 +467,7 @@ class ActivityController extends Controller
}
$activity->parent_id = $activityStack[count($activityStack) - 1]->id ?? null;
array_push($activityStack, $activity);
// there should be better way to except / filter attribute level before save because it's cause error
// cant use except() / filter() on $activity collection somehow
unset($activity->level);

Loading…
Cancel
Save