Fixed rake task to create weekly tasks.
This commit is contained in:
parent
f1b71a5588
commit
524d9b7c7a
1 changed files with 3 additions and 1 deletions
|
@ -25,7 +25,9 @@ namespace :foodsoft do
|
||||||
workgroups = Workgroup.all :conditions => {:weekly_task => true}
|
workgroups = Workgroup.all :conditions => {:weekly_task => true}
|
||||||
for workgroup in workgroups
|
for workgroup in workgroups
|
||||||
puts "Create weekly tasks for #{workgroup.name}"
|
puts "Create weekly tasks for #{workgroup.name}"
|
||||||
workgroup.next_weekly_tasks[3..5].each do |date|
|
# Loop through next tasks weekly tasks method,
|
||||||
|
# skip the next 3 weeks, to allow manually deleting tasks
|
||||||
|
workgroup.next_weekly_tasks[3..-1].each do |date|
|
||||||
unless workgroup.tasks.exists?({:due_date => date, :weekly => true})
|
unless workgroup.tasks.exists?({:due_date => date, :weekly => true})
|
||||||
workgroup.tasks.create(workgroup.task_attributes(date))
|
workgroup.tasks.create(workgroup.task_attributes(date))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue