From c6d5522099c1df70bd334affce2578fdab57d695 Mon Sep 17 00:00:00 2001 From: Michal Feher Date: Fri, 12 Jul 2024 12:29:44 +0200 Subject: [PATCH] no message --- be/app/Http/Controllers/SubTaskController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/be/app/Http/Controllers/SubTaskController.php b/be/app/Http/Controllers/SubTaskController.php index 9007bd3..a46c82f 100644 --- a/be/app/Http/Controllers/SubTaskController.php +++ b/be/app/Http/Controllers/SubTaskController.php @@ -73,9 +73,13 @@ class SubTaskController extends Controller $userIdArray = [$parameters['user_id']]; } + $blockers1 = Blocker::whereIn('user_id', $userIdArray)->where('start', '>', $start)->get(); - $blockers = Blocker::whereIn('user_id', $userIdArray)->where('start', '>', $start)->where('end', '<', - $end)->get(); + // vacation can last more than 7 days what is the date range we use in filter. we need to check also for vacations that started before 7 days and end after 7 days + $blockers2 = Blocker::whereIn('user_id', $userIdArray)->where('start', '<=', $start)->where('end', '>', + $start)->get(); + + $blockers = $blockers1->merge($blockers2); return response()->json([ 'subtasks' => SubTaskResource::collection($subtasks),