Class: Effective::WorkExperienceReport
- Inherits:
-
Object
- Object
- Effective::WorkExperienceReport
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/effective/work_experience_report.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
The intern.
Instance Method Summary collapse
- #backdated_work_experience_record ⇒ Object
- #end_on ⇒ Object
- #mentor ⇒ Object
- #start_on ⇒ Object
- #to_param ⇒ Object
- #to_s ⇒ Object
- #total_hours ⇒ Object
- #work_experience_records ⇒ Object
- #work_experience_subcategories ⇒ Object
- #years ⇒ Object
Instance Attribute Details
#user ⇒ Object
The intern
6 7 8 |
# File 'app/models/effective/work_experience_report.rb', line 6 def user @user end |
Instance Method Details
#backdated_work_experience_record ⇒ Object
20 21 22 |
# File 'app/models/effective/work_experience_report.rb', line 20 def backdated_work_experience_record work_experience_records.find(&:backdated?) end |
#end_on ⇒ Object
28 29 30 |
# File 'app/models/effective/work_experience_report.rb', line 28 def end_on work_experience_records.select { |work_experience_record| work_experience_record.month.present? }.map(&:month).sort.last end |
#mentor ⇒ Object
16 17 18 |
# File 'app/models/effective/work_experience_report.rb', line 16 def mentor user&.try(:work_experience_mentor) end |
#start_on ⇒ Object
24 25 26 |
# File 'app/models/effective/work_experience_report.rb', line 24 def start_on work_experience_records.select { |work_experience_record| work_experience_record.month.present? }.map(&:month).sort.first end |
#to_param ⇒ Object
12 13 14 |
# File 'app/models/effective/work_experience_report.rb', line 12 def to_param user&.to_param end |
#to_s ⇒ Object
8 9 10 |
# File 'app/models/effective/work_experience_report.rb', line 8 def to_s 'Work Experience Report' end |
#total_hours ⇒ Object
37 38 39 |
# File 'app/models/effective/work_experience_report.rb', line 37 def total_hours work_experience_records.sum { |work_experience_record| work_experience_record.total_hours.to_f }.round(2) end |
#work_experience_records ⇒ Object
45 46 47 48 |
# File 'app/models/effective/work_experience_report.rb', line 45 def work_experience_records return unless user.present? @work_experience_records ||= user.work_experience_records end |
#work_experience_subcategories ⇒ Object
41 42 43 |
# File 'app/models/effective/work_experience_report.rb', line 41 def work_experience_subcategories @work_experience_subcategories ||= Effective::WorkExperienceSubcategory.all.sorted end |
#years ⇒ Object
32 33 34 35 |
# File 'app/models/effective/work_experience_report.rb', line 32 def years return [] unless start_on.present? (start_on.year..end_on.year).to_a end |