From 524d9b7c7a921fd577fbece3626a557dac00db1a Mon Sep 17 00:00:00 2001 From: benni Date: Tue, 26 Jun 2012 23:18:55 +0200 Subject: [PATCH] Fixed rake task to create weekly tasks. --- lib/tasks/foodsoft.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/foodsoft.rake b/lib/tasks/foodsoft.rake index c1444361..446f2ace 100644 --- a/lib/tasks/foodsoft.rake +++ b/lib/tasks/foodsoft.rake @@ -25,7 +25,9 @@ namespace :foodsoft do workgroups = Workgroup.all :conditions => {:weekly_task => true} for workgroup in workgroups 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}) workgroup.tasks.create(workgroup.task_attributes(date)) end