From 37a323fc25a041f6a14c9a3a107caae79f3c8b76 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 30 May 2025 13:38:01 +0200 Subject: [PATCH] Fix due dates on calendar [SCI-11925] --- app/controllers/dashboard/calendars_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/dashboard/calendars_controller.rb b/app/controllers/dashboard/calendars_controller.rb index 50c101638..b03b086c6 100644 --- a/app/controllers/dashboard/calendars_controller.rb +++ b/app/controllers/dashboard/calendars_controller.rb @@ -6,28 +6,28 @@ module Dashboard include MyModulesHelper def show - date = params[:date].in_time_zone(current_user.time_zone) + date = params[:date].to_datetime start_date = date.at_beginning_of_month.utc - 8.days end_date = date.at_end_of_month.utc + 15.days due_dates = current_user.my_modules.readable_by_user(current_user).active.uncomplete .joins(experiment: :project) .where(experiments: { archived: false }) .where(projects: { archived: false }) - .where('my_modules.due_date > ? AND my_modules.due_date < ?', start_date, end_date) + .where('my_modules.due_date >= ? AND my_modules.due_date <= ?', start_date, end_date) .joins(:protocols).where(protocols: { team_id: current_team.id }) .pluck(:due_date) render json: { events: due_dates.map { |i| { date: i.to_date } } } end def day - date = params[:date].in_time_zone(current_user.time_zone) + date = params[:date].to_datetime start_date = date.utc end_date = date.end_of_day.utc my_modules = current_user.my_modules.readable_by_user(current_user).active.uncomplete .joins(experiment: :project) .where(experiments: { archived: false }) .where(projects: { archived: false }) - .where('my_modules.due_date > ? AND my_modules.due_date < ?', start_date, end_date) + .where('my_modules.due_date >= ? AND my_modules.due_date <= ?', start_date, end_date) .where(projects: { team_id: current_team.id }) render json: { html: render_to_string(partial: 'shared/my_modules_list_partial',