mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
fix issue where deleting a recurring todo from tickler results in an error
This commit is contained in:
parent
dcac7611ed
commit
9acb01e9cb
3 changed files with 7 additions and 5 deletions
|
|
@ -675,8 +675,9 @@ class TodosController < ApplicationController
|
|||
@recurring_todo = nil
|
||||
if @todo.from_recurring_todo?
|
||||
@recurring_todo = current_user.recurring_todos.find(@todo.recurring_todo_id)
|
||||
if @recurring_todo.active? && @recurring_todo.has_next_todo(@todo.due)
|
||||
date = @todo.due >= Date.today() ? @todo.due : Date.today()-1.day
|
||||
date_to_check = @todo.due.nil? ? @todo.show_from : @todo.due
|
||||
if @recurring_todo.active? && @recurring_todo.has_next_todo(date_to_check)
|
||||
date = date_to_check >= Date.today() ? date_to_check : Date.today()-1.day
|
||||
@new_recurring_todo = create_todo_from_recurring_todo(@recurring_todo, date)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ class RecurringTodo < ActiveRecord::Base
|
|||
|
||||
when 1 # relative weekday of a month
|
||||
the_next = get_xth_day_of_month(self.every_other3, self.every_count, start.month, start.year)
|
||||
if the_next.nil? || the_next < start
|
||||
if the_next.nil? || the_next <= start
|
||||
# the nth day is already passed in this month, go to next month and try
|
||||
# again
|
||||
the_next = the_next+n.months
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ class RecurringTodoTest < Test::Rails::TestCase
|
|||
|
||||
# check show from get the next day
|
||||
assert_equal @today, @every_day.get_show_from_date(@today-1.days)
|
||||
assert_equal @today+1.day, @every_day.get_show_from_date(@today)
|
||||
|
||||
@every_day.target='due_date'
|
||||
# when target on due_date, show_from is relative to due date unless delta=0
|
||||
|
|
@ -146,7 +147,7 @@ class RecurringTodoTest < Test::Rails::TestCase
|
|||
assert_equal Time.utc(2008,6,27), due_date
|
||||
|
||||
friday_is_last_day_of_month = Time.utc(2008,10,31)
|
||||
due_date = @monthly_every_last_friday.get_due_date(friday_is_last_day_of_month )
|
||||
due_date = @monthly_every_last_friday.get_due_date(friday_is_last_day_of_month-1.day )
|
||||
assert_equal friday_is_last_day_of_month , due_date
|
||||
|
||||
@monthly_every_third_friday = @monthly_every_last_friday
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue