Skip to content

Commit

Permalink
Remove changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hschallhorn committed Jun 2, 2020
1 parent fa0d210 commit d18185c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,13 @@ def verify_user_can_update!(user)
end

def reassign(reassign_params, current_user)
sibling = Task.create!(
attributes.merge(
id: nil,
assigned_by_id: self.class.child_assigned_by_id(parent, current_user),
assigned_to: self.class.child_task_assignee(parent, reassign_params),
instructions: flattened_instructions(reassign_params),
status: Constants.TASK_STATUSES.assigned
)
)
sibling = dup.tap do |task|
task.assigned_by_id = self.class.child_assigned_by_id(parent, current_user)
task.assigned_to = self.class.child_task_assignee(parent, reassign_params)
task.instructions = flattened_instructions(reassign_params)
task.status = Constants.TASK_STATUSES.assigned
task.save!
end

# Preserve the open children and status of the old task
children.select(&:stays_with_reassigned_parent?).each { |child| child.update!(parent_id: sibling.id) }
Expand Down

0 comments on commit d18185c

Please sign in to comment.