Merge branch 'feature/edit-recurring-task'
Conflicts: config/locales/en.yml
This commit is contained in:
commit
ec03d579d0
8 changed files with 97 additions and 55 deletions
|
|
@ -25,6 +25,22 @@ class PeriodicTaskGroup < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
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,
|
||||
due_date: task.due_date + due_date_delta)
|
||||
end
|
||||
group_tasks.each do |task|
|
||||
task.update_columns(periodic_task_group_id: self.id)
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# @return [Number] Number of days between two periodic tasks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue