Allow configuration of task periods
This commit is contained in:
parent
6e990fed4c
commit
f6c008c79c
7 changed files with 43 additions and 10 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue