mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-28 11:46:10 +01:00
Fixes corner case where checking a monthly recurring todo complete on
the same day the todo comes from tickler, a new todo is created and not put in the tickler for next month, but for today
This commit is contained in:
parent
e31b05a697
commit
f21908a2a0
2 changed files with 51 additions and 5 deletions
|
|
@ -781,10 +781,8 @@ class TodosController < ApplicationController
|
|||
# check for next todo either from the due date or the show_from date
|
||||
date_to_check = todo.due.nil? ? todo.show_from : todo.due
|
||||
|
||||
# if both due and show_from are nil, check for a next todo with yesterday
|
||||
# as reference point. We pick yesterday so that new todos for today will
|
||||
# be created instead of new todos for tomorrow.
|
||||
date_to_check = Time.zone.now-1.day if date_to_check.nil?
|
||||
# if both due and show_from are nil, check for a next todo from now
|
||||
date_to_check = Time.zone.now if date_to_check.nil?
|
||||
|
||||
if recurring_todo.active? && recurring_todo.has_next_todo(date_to_check)
|
||||
|
||||
|
|
@ -792,7 +790,9 @@ class TodosController < ApplicationController
|
|||
# the past. This is to make sure we do not get older todos for overdue
|
||||
# todos. I.e. checking a daily todo that is overdue with 5 days will
|
||||
# create a new todo which is overdue by 4 days if we don't shift the
|
||||
# date. Discard the time part in the compare
|
||||
# date. Discard the time part in the compare. We pick yesterday so that
|
||||
# new todos due for today will be created instead of new todos for
|
||||
# tomorrow.
|
||||
date = date_to_check.at_midnight >= Time.zone.now.at_midnight ? date_to_check : Time.zone.now-1.day
|
||||
|
||||
new_recurring_todo = create_todo_from_recurring_todo(recurring_todo, date)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue