Class: KeyPersonnelCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb

Overview

KeyPersonObject

Instance Method Summary collapse

Instance Method Details

#co_investigatorObject



280
281
282
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 280

def co_investigator
  self.find { |person| person.role=='Co-Investigator' }
end

#key_person(role) ⇒ Object



284
285
286
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 284

def key_person(role)
  self.find { |person| person.key_person_role==role }
end

#namesObject



246
247
248
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 246

def names
  self.collect { |person| person.full_name }
end

#person(full_name) ⇒ Object



266
267
268
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 266

def person(full_name)
  self.find { |person| person.full_name==full_name }
end

#principal_investigatorObject



276
277
278
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 276

def principal_investigator
  self.find { |person| person.role=='Principal Investigator' || person.role=='PI/Contact' }
end

#rolesObject



250
251
252
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 250

def roles
  self.collect{ |person| person.role }.uniq
end

#uncertified_person(role) ⇒ Object

IMPORTANT: This method returns a KeyPersonObject–meaning that if there are multiple key persons in the collection that match this search only the first one will be returned. If you need a collection of multiple persons write the method for that.



292
293
294
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 292

def uncertified_person(role)
  self.find { |person| person.certified==false && person.role==role }
end

#unit_namesObject



254
255
256
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 254

def unit_names
  units.collect{ |unit| unit[:name] }.uniq
end

#unit_numbersObject



258
259
260
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 258

def unit_numbers
  units.collect{ |unit| unit[:number] }.uniq
end

#unitsObject



262
263
264
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 262

def units
  self.collect{ |person| person.units }.flatten
end

#with_unitsObject

returns an array of KeyPersonObjects who have associated units



272
273
274
# File 'lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb', line 272

def with_units
  self.find_all { |person| person.units.size > 0 }
end