Class: Project

Inherits:
ApplicationRecord show all
Extended by:
EventfulRecord, Metadata
Includes:
AASM, Api::Messages::FlowcellIO::ProjectExtensions, Api::ProjectIO::Extensions, EventfulRecord, ModelExtensions::Project, Role::Authorized, SharedBehaviour::Named, Uuid::Uuidable
Defined in:
app/models/project.rb

Overview

rubocop:todo Style/Documentation

Defined Under Namespace

Classes: Metadata

Constant Summary collapse

ACTIVE_STATE =
'active'.freeze
PROJECT_FUNDING_MODELS =
[
  '',
  'Internal',
  'External',
  'External - own machine'
].freeze

Constants included from Metadata

Metadata::SECTION_FIELDS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Metadata

has_metadata

Methods included from EventfulRecord

has_many_events, has_many_lab_events, has_one_event_with_family

Methods included from SharedBehaviour::Named

included

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods included from Api::ProjectIO::Extensions

included

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Class Method Details

.statesObject


18
19
20
# File 'app/models/project.rb', line 18

def self.states
  Project.aasm.states.map(&:name)
end

Instance Method Details

#actionable?Boolean

Returns:

  • (Boolean)

93
94
95
# File 'app/models/project.rb', line 93

def actionable?
  .budget_division.name != 'Unallocated'
end

#managerObject


89
90
91
# File 'app/models/project.rb', line 89

def manager
  managers.first
end

#ownerObject


85
86
87
# File 'app/models/project.rb', line 85

def owner
  owners.first
end

#r_and_d?Boolean

Returns:

  • (Boolean)

104
105
106
# File 'app/models/project.rb', line 104

def r_and_d?
  .budget_division.name == configatron.r_and_d_division
end

#sequencing_budget_divisionObject


108
109
110
# File 'app/models/project.rb', line 108

def sequencing_budget_division
  .budget_division.name
end

#subject_typeObject


147
148
149
# File 'app/models/project.rb', line 147

def subject_type
  'project'
end

#submittable?Boolean

Returns:

  • (Boolean)

97
98
99
100
101
102
# File 'app/models/project.rb', line 97

def submittable?
  return true if .project_funding_model.present?

  errors.add(:base, 'No funding model specified')
  false
end