Class: WorkRequirement
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- WorkRequirement
show all
- Includes:
- ErpTechSvcs::Utils::DefaultNestedSetMethods
- Defined in:
- app/models/work_requirement.rb
Instance Method Summary
collapse
Instance Method Details
#add_status_type(status_type, is_initial_status = false) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'app/models/work_requirement.rb', line 26
def add_status_type(status_type, is_initial_status=false)
status_rel = WorkRequirementWorkEffortStatusType.new
status_rel.work_effort_status_type = status_type
if is_initial_status
clear_initial_status_type
status_rel.is_initial_status = is_initial_status
end
status_rel.work_requirement = self
status_rel.save
end
|
#create_work_efforts(effort_class, initial_status_type = nil) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/models/work_requirement.rb', line 42
def create_work_efforts(effort_class, initial_status_type=nil)
parent_effort = create_effort(effort_class, self)
self.children.each{ |req_child|
child_effort = create_effort(effort_class, req_child)
child_effort.work_effort.move_to_child_of(parent_effort.work_effort)
child_effort.save!
}
initial_status_type.nil? ? parent_effort.start(initial_work_effort_status_type) : parent_effort.start(initial_status_type)
parent_effort
end
|
#initial_work_effort_status_type ⇒ Object
37
38
39
40
|
# File 'app/models/work_requirement.rb', line 37
def initial_work_effort_status_type
status_rel = get_initial_status_type
status_rel.nil? ? (raise "No Initial Status Set For Requirement") : status_rel.work_effort_status_type
end
|
#set_status_type_as_initial_status(status_type) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/models/work_requirement.rb', line 14
def set_status_type_as_initial_status(status_type)
changing_status_type = self.work_effort_status_types.find_by_internal_identifier(status_type.internal_identifier)
unless changing_status_type.nil?
clear_initial_status_type
changed_status_type = self.work_requirement_work_effort_status_types.find(:first, :conditions => ["work_effort_status_type_id = ?", changing_status_type.id])
changed_status_type.is_initial_status = true
changed_status_type.save
else
raise "Work Requirement Does Not Contain Work Effort Status Type"
end
end
|