diff --git a/app/Console/Commands/CalculateSCurve.php b/app/Console/Commands/CalculateSCurve.php index 72a2e37..2d005d7 100644 --- a/app/Console/Commands/CalculateSCurve.php +++ b/app/Console/Commands/CalculateSCurve.php @@ -25,7 +25,5 @@ class CalculateSCurve extends Command $project->scurve = json_encode($data); $project->calculation_status = true; $project->save(); - - return $data; } } diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index b93588d..9108ceb 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -473,11 +473,11 @@ class MasterFunctionsHelper { $minDate = $dataProject->mulai_proyek; - $begin = new \DateTime($minDate.' Monday'); + $begin = new \DateTime($minDate); $begin->modify('last Monday'); if(isset($dataPayload['end_date'])){ $maxDate = $dataPayload['end_date']; - $end = new \DateTime($maxDate. ' Friday'); + $end = new \DateTime($maxDate); $end->modify('next Friday'); $end->modify('next Friday'); /* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged @@ -488,7 +488,7 @@ class MasterFunctionsHelper { // ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') // ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's $maxDate = $dataProject->akhir_proyek; - $end = new \DateTime($maxDate. ' Friday'); + $end = new \DateTime($maxDate); $end->modify('next Friday'); $end->modify('next Friday'); $interval = new \DateInterval('P7D'); diff --git a/app/Models/HierarchyFtth.php b/app/Models/HierarchyFtth.php index 34fd7d3..fae503c 100644 --- a/app/Models/HierarchyFtth.php +++ b/app/Models/HierarchyFtth.php @@ -14,4 +14,15 @@ class HierarchyFtth extends Model protected $fillable = [ 'name', 'parent_id', 'project_id', 'created_at', 'updated_at', 'progress', 'bobot_planning' ]; + + public static function boot() { + parent::boot(); + + static::deleted(function($data) { + $ftths = HierarchyFtth::where('parent_id', $data->id)->get(); + foreach ($ftths as $ftth) { + $ftth->delete(); + } + }); + } }