myneid / Redmine-Periodic-Task

A redmine plugin that lets you schedule an issue to fire every x days/weeks/months
25 stars 11 forks source link

Next run date is calculated improperly #5

Open shadowpanther opened 12 years ago

shadowpanther commented 12 years ago

Today is 2011-12-01. I have a task with next date set, say, to 2011-12-01 00:00:00. When cron job runs at 01:00, next run time is set to something like 2012-01-01 01:00:30 (seconds depend on cron job run time). Then, because you are comparing next run date to today's date only (without time), next time this task actually runs is 2012-01-02, and next run time would be set to 2012-02-02 01:00:30 and so on.

The simple solution would be to do: task.next_run_date = interval.send(units.downcase).from_now.to_date in scheduled_tasks_checker.rb, converting DateTime to Date, so next run time for today's task would be set to 2012-01-01 00:00:00.

myneid commented 12 years ago

fork it and make a pull request i will review it and merge it

Wolfer commented 9 years ago

I make pull request #17