Class: Errbit::Cloudfuji::EventObservers::ProjectTaskObserver

Inherits:
Cloudfuji::EventObserver
  • Object
show all
Defined in:
lib/errbit/cloudfuji/event_observers/project_task_observer.rb

Instance Method Summary collapse

Instance Method Details

#project_task_createdObject Also known as: project_task_updated



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/errbit/cloudfuji/event_observers/project_task_observer.rb', line 6

def project_task_created
  data = params['data']
  # Find error with matching ido_id
  if data['ido_id'] && err = Err.where(:ido_id => data['ido_id']).first
    # Update issue link on error with task url
    if data['url'] && err.problem.issue_link != data['url']
      err.problem.update_attribute :issue_link, data['url']
    end

    # If task state is 'accepted', then resolve the error
    if data['state'] == 'accepted'
      err.problem.resolve!
    end
  end
end