From 1cee061182f63e94c45c1f7d9290822f18d3627f Mon Sep 17 00:00:00 2001 From: Nishant Samel Date: Mon, 18 Mar 2024 19:27:48 +0530 Subject: [PATCH] Fetch current month entries only instead of fetching 3 months entries --- app/controllers/internal_api/v1/time_tracking_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/internal_api/v1/time_tracking_controller.rb b/app/controllers/internal_api/v1/time_tracking_controller.rb index 489b1a491b..4a60217c8a 100644 --- a/app/controllers/internal_api/v1/time_tracking_controller.rb +++ b/app/controllers/internal_api/v1/time_tracking_controller.rb @@ -8,8 +8,8 @@ class InternalApi::V1::TimeTrackingController < InternalApi::V1::ApplicationCont def index authorize :index, policy_class: TimeTrackingPolicy year = params[:year] || Date.today.year - from = params[:from] || 1.month.ago.beginning_of_month - to = params[:to] || 1.month.since.end_of_month + from = params[:from] || Time.current.beginning_of_month + to = params[:to] || Time.current.end_of_month data = TimeTrackingIndexService.new(current_user:, user: @user, company: current_company, from:, to:, year:).process