From abad8c77ee0bbb4346c40b9a4f4b8c4673f0c5e7 Mon Sep 17 00:00:00 2001 From: Jyri-Petteri Paloposki Date: Sun, 6 Sep 2020 14:06:57 +0300 Subject: [PATCH] =?UTF-8?q?#2472:=20Fix=20fetching=20calendar=20ID=20on=20?= =?UTF-8?q?task=20update.=20Didn't=20figure=20out=20when=20this=20has=20be?= =?UTF-8?q?en=20broken=20=E2=80=93=20could=20be=20c66ce02cb,=20but=20not?= =?UTF-8?q?=20sure=20how.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/todos_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index aa629cda..776f92f9 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -423,6 +423,7 @@ class TodosController < ApplicationController @todo = current_user.todos.find(params['id']) @original_item = current_user.todos.build(@todo.attributes) # create a (unsaved) copy of the original todo + @original_item_due_id = get_due_id_for_calendar(@original_item.due) update_tags update_project @@ -442,7 +443,6 @@ class TodosController < ApplicationController @saved = false end - provide_project_or_context_for_view # this is set after save and cleared after reload, so save it here @@ -1138,18 +1138,18 @@ end end def count_old_due_empty(id) - due_today_date = Time.zone.now - due_this_week_date = Time.zone.now.end_of_week - due_next_week_date = due_this_week_date + 7.days - due_this_month_date = Time.zone.now.end_of_month case id when "due_today" + due_today_date = Time.zone.now return current_user.todos.not_completed.where('todos.due <= ?', due_today_date).count when "due_this_week" + due_this_week_date = Time.zone.now.end_of_week return current_user.todos.not_completed.where('todos.due > ? AND todos.due <= ?', due_today_date, due_this_week_date).count when "due_next_week" + due_next_week_date = due_this_week_date + 7.days return current_user.todos.not_completed.where('todos.due > ? AND todos.due <= ?', due_this_week_date, due_next_week_date).count when "due_this_month" + due_this_month_date = Time.zone.now.end_of_month return current_user.todos.not_completed.where('todos.due > ? AND todos.due <= ?', due_next_week_date, due_this_month_date).count when "due_after_this_month" return current_user.todos.not_completed.where('todos.due > ?', due_this_month_date).count