Module: Dunlop::WorkflowStepModel::ClassMethods

Defined in:
app/models/dunlop/workflow_step_model.rb

Instance Method Summary collapse

Instance Method Details

#activate_dunlop!Object



49
50
51
# File 'app/models/dunlop/workflow_step_model.rb', line 49

def activate_dunlop!
  # for possible future use dealing with class settings using this module's methods
end

#final_statesObject



67
68
69
# File 'app/models/dunlop/workflow_step_model.rb', line 67

def final_states
  %w[completed rejected]
end

#scope_for(user, options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'app/models/dunlop/workflow_step_model.rb', line 53

def scope_for(user, options = {})
  archived = !!options[:archived]
  #if user.service_provider_id.present?
    #joins(:migration).where(migrations: {service_provider_id: user.service_provider_id, archived: archived})
  #else
    #joins(:migration).where(migrations: {archived: archived})
  #end
  if archived
    joins(:workflow_instance).where.not(workflow_instances: {archived_at: nil})
  else
    joins(:workflow_instance).where(workflow_instances: {archived_at: nil})
  end
end