From b25723c9367db426234d94fc7e33ede690c7657d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 28 Jul 2023 08:54:46 +0700 Subject: [PATCH 1/2] Fix dayoff --- app/Http/Controllers/ActivityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 15e6cb4..708b3a5 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -353,7 +353,7 @@ class ActivityController extends Controller Activity::where('version_gantt_id', $data['ganttId'])->delete(); $projectId = VersionGantt::where('id', $data['ganttId'])->first()->proyek_id; - $dayOffs = VersionGantt::find($data['ganttId'])->first()->config_dayoff; + $dayOffs = VersionGantt::where('id', $data['ganttId'])->first()->config_dayoff; $activityStack = []; From b0b2c7b89f722bf98ec6e96692566e79559b5695 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 28 Jul 2023 10:35:12 +0700 Subject: [PATCH 2/2] Fix Sync Report --- app/Http/Controllers/ProjectController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 43dadf9..158b77e 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -350,20 +350,21 @@ class ProjectController extends Controller } public static function setSyncDate($activity_id, $activity, $report) { - $status = ReportActivityMaterial::select('description')->where('activity_id', $activity_id)->first(); - if (isset($status) && $status != 'done') { + $status = AssignMaterial::select('status_activity')->where('activity_id', $activity_id)->first(); + if (isset($status->status_activity) && $status->status_activity != 'done') { $minDate = date_create($report->report_date); $maxDate = date_create($report->report_date); date_add($maxDate, date_interval_create_from_date_string($activity->duration . " days")); } else { $material = AssignMaterial::where('activity_id', $activity_id)->first(); - $minDate = $material->start_activity; - $maxDate = $material->finish_activity; + $minDate = date_create($material->start_activity); + $maxDate = date_create($material->finish_activity); } $reports = array( 'activity_id' => $activity_id, 'min_date' => $minDate, - 'max_date' => $maxDate + 'max_date' => $maxDate, + 'status' => $status->status_activity ); return $reports; } @@ -397,8 +398,8 @@ class ProjectController extends Controller if ($successor) { $predecessor = Activity::find($successor->s_activity_id); $activity->start_date = $predecessor->end_date; - $reports[$i]['max_date']->modify('1 day'); - } else { + } + if($reports[$i]['status'] != 'done'){ $reports[$i]['max_date']->modify('-1 day'); } $activity->start_date = $reports[$i]['min_date'];