Class: RailsExecution::Task

Inherits:
AppModel show all
Defined in:
app/models/rails_execution/task.rb

Constant Summary collapse

PROCESSING_STATUSES =
%w(created reviewing approved rejected)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#reviewer_idsObject

Returns the value of attribute reviewer_ids.



8
9
10
# File 'app/models/rails_execution/task.rb', line 8

def reviewer_ids
  @reviewer_ids
end

Instance Method Details

#add_files(attachments, current_owner) ⇒ Object



52
53
54
# File 'app/models/rails_execution/task.rb', line 52

def add_files(attachments, current_owner)
  ::RailsExecution.configuration.file_uploader.new(self, attachments, owner: current_owner).call
end

#assign_reviewers(ids) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'app/models/rails_execution/task.rb', line 36

def assign_reviewers(ids)
  ids.each do |id|
    next if id.blank?

    task_review = self.task_reviews.find_or_initialize_by({
      owner_id: id,
      owner_type: ::RailsExecution.configuration.owner_model.to_s,
    })
    task_review.status ||= :reviewing
  end
end

#in_processing?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/rails_execution/task.rb', line 32

def in_processing?
  PROCESSING_STATUSES.include?(self.status)
end