Reduced number of generated weekly tasks.

This commit is contained in:
Benjamin Meichsner 2009-08-11 18:39:21 +02:00
parent 49be55238b
commit 58ce422ef7

View file

@ -44,7 +44,7 @@ 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(8)[3..7].each do |date| workgroup.next_weekly_tasks(8)[3..5].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