Merge pull request #331 from foodcoops/feature/configure-upfront-tasks

Configure upfront tasks
This commit is contained in:
wvengen 2014-12-06 14:35:22 +01:00
commit cee2ac8f9f
11 changed files with 46 additions and 44 deletions

View file

@ -226,6 +226,8 @@ class FoodsoftConfig
currency_space: true,
foodsoft_url: 'https://github.com/foodcoops/foodsoft',
contact: {}, # avoid errors when undefined
tasks_period_days: 7,
tasks_upfront_days: 49,
# The following keys cannot, by default, be set by foodcoops themselves.
protected: {
multi_coop_install: true,

View file

@ -40,7 +40,9 @@ namespace :foodsoft do
task :create_upcoming_periodic_tasks => :environment do
for tg in PeriodicTaskGroup.all
if tg.has_next_task?
while tg.next_task_date.nil? or tg.next_task_date < Date.today + 50
create_until = Date.today + FoodsoftConfig[:tasks_upfront_days].to_i + 1
rake_say "creating until #{create_until}"
while tg.next_task_date.nil? or tg.next_task_date < create_until
tg.create_next_task
end
end