From f32f16d03851d266eebea74296b26c0850916ab1 Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 28 Aug 2023 16:32:48 +0700 Subject: [PATCH] fix till date --- app/Http/Controllers/ProjectController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 0a37a92..3a204d7 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -484,11 +484,14 @@ class ProjectController extends Controller if(!$result) return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404); //TODO possible overdue bug + $endDate = Activity::where('proyek_id', $payload['id']) + ->orderByDesc('end_date') + ->value('end_date'); if(isset($payload['till_date'])) { if (isset($payload['scurve'])) { - $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); + $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$endDate)->orderBy('end_date', 'asc')->get(); } else { - $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); + $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$endDate)->orderBy('end_date', 'asc')->get(); } } else {