Move due date according to delta
This commit is contained in:
parent
fd51b07e21
commit
a8a434ef7b
2 changed files with 6 additions and 3 deletions
|
|
@ -25,14 +25,16 @@ class PeriodicTaskGroup < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def update_tasks_including(template_task)
|
||||
def update_tasks_including(template_task, prev_due_date)
|
||||
group_tasks = tasks + [template_task]
|
||||
due_date_delta = template_task.due_date - prev_due_date
|
||||
tasks.each do |task|
|
||||
task.update!(name: template_task.name,
|
||||
description: template_task.description,
|
||||
duration: template_task.duration,
|
||||
required_users: template_task.required_users,
|
||||
workgroup: template_task.workgroup)
|
||||
workgroup: template_task.workgroup,
|
||||
due_date: task.due_date + due_date_delta)
|
||||
end
|
||||
group_tasks.each do |task|
|
||||
task.update_columns(periodic_task_group_id: self.id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue