diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 23ef012..3c60307 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -351,51 +351,51 @@ class ActivityController extends Controller $activityStack = []; - $hasWeight = false; - - foreach ($data['activities'] as $key => $value) { - if(isset($value['weight']) && $value['weight'] != null && $value['weight'] != 0){ - $hasWeight = true; - break; - } - } - - if(!$hasWeight){ - foreach ($data['activities'] as $key => $value) { - if($key == 0){ - $data['activities'][$key]['weight'] = 100; - } else { - $parentWeight = 0; - $siblingsCount = 1; - - $i = $key; - while($i > 0){ - if ($data['activities'][$i - 1]['level'] == $data['activities'][$key]['level']-1){ - $parentWeight = $data['activities'][$i - 1]['weight']; - break; - } - if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']){ - $siblingsCount++; - } - $i--; - } - - $i = $key+1; - while($i < count($data['activities'])){ - if ($data['activities'][$i]['level'] == $data['activities'][$key]['level']-1){ - break; - } - // Log::info('level '.$data['activities'][$key]['level'].' i level '.$data['activities'][$i]['level']); - if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']){ - $siblingsCount++; - } - $i++; - } - - $data['activities'][$key]['weight'] = $parentWeight / $siblingsCount; - } - }; - } + // $hasWeight = false; + // + // foreach ($data['activities'] as $key => $value) { + // if(isset($value['weight']) && $value['weight'] != null && $value['weight'] != 0){ + // $hasWeight = true; + // break; + // } + // } + // + // if(!$hasWeight){ + // foreach ($data['activities'] as $key => $value) { + // if($key == 0){ + // $data['activities'][$key]['weight'] = 100; + // } else { + // $parentWeight = 0; + // $siblingsCount = 1; + // + // $i = $key; + // while($i > 0){ + // if ($data['activities'][$i - 1]['level'] == $data['activities'][$key]['level']-1){ + // $parentWeight = $data['activities'][$i - 1]['weight']; + // break; + // } + // if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']){ + // $siblingsCount++; + // } + // $i--; + // } + // + // $i = $key+1; + // while($i < count($data['activities'])){ + // if ($data['activities'][$i]['level'] == $data['activities'][$key]['level']-1){ + // break; + // } + // // Log::info('level '.$data['activities'][$key]['level'].' i level '.$data['activities'][$i]['level']); + // if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']){ + // $siblingsCount++; + // } + // $i++; + // } + // + // $data['activities'][$key]['weight'] = $parentWeight / $siblingsCount; + // } + // }; + // } $projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first(); foreach ($data['activities'] as $i => $activity_row) { $startDate = \DateTime::createFromFormat('Y-m-d H:i:s.uP', $projectStart->mulai_proyek);