fix regression in recurring todos

This commit is contained in:
Reinier Balt 2013-09-17 15:40:20 +02:00
parent a31c0a7a5d
commit 62bc47b26b
2 changed files with 2 additions and 5 deletions

View file

@ -489,7 +489,7 @@ class RecurringTodo < ActiveRecord::Base
case self.recurrence_selector
when 0 # specific day of the month
if start.mday >= day
if (previous && start.mday >= day) || (previous.nil? && start.mday > day)
# there is no next day n in this month, search in next month
#
# start += n.months

View file

@ -175,9 +175,6 @@ class RecurringTodoTest < ActiveSupport::TestCase
assert_equal @sunday, due_date # june 8th
due_date = @monthly.get_due_date(@sunday) # june 8th
assert_equal Time.zone.local(2008,6,8), due_date # june 8th
due_date = @monthly.get_due_date(@monday) # june 9th
assert_equal Time.zone.local(2008,8,8), due_date # aug 8th
end
@ -247,7 +244,7 @@ class RecurringTodoTest < ActiveSupport::TestCase
# every_day should return start_day if it is in the future
@every_day.start_from = @in_three_days
due_date = @every_day.get_due_date(nil)
assert_equal @in_three_days, due_date
assert_equal @in_three_days.to_s(:db), due_date.to_s(:db)
due_date = @every_day.get_due_date(@tomorrow)
assert_equal @in_three_days, due_date