From 5be0e54280b252e7331b86c3e23fcaf0baa62bde Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Fri, 12 Jan 2018 16:43:26 +0800 Subject: [PATCH] added experience --- app/controllers/recruitments_controller.rb | 18 ++++++++++++------ app/models/employee_academic.rb | 10 ++++++++++ app/models/employee_experience.rb | 10 +++++++++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 84e7a60..4ceb57e 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -168,18 +168,23 @@ class RecruitmentsController < PseudoSessionController academics = [] profile.employee_academics.each do |aca| - if !aca.end_date.nil? - period = aca.start_date.strftime("%Y/%m/%d") + " ~ " + aca.end_date.strftime("%Y/%m/%d") - else - period = aca.start_date.strftime("%Y/%m/%d") + " ~ current" - end academics << { "title" => (t("recruitment.academic_type.#{aca.academic_type}") + " " + t("recruitment.in") + " " + aca.degree_name), - "period" => period, + "period" => aca.period, "note" => aca.note } end + experiences = [] + profile.employee_experiences.asc(:end_date).each do |exp| + experiences << { + "job-title" => exp.job_title, + "company-name" => exp.company_name, + "period" => exp.period, + "responsibilities" => exp.responsibilities + } + end + if profile.experience_years == 0 && profile.experience_months == 0 experience = t("recruitment.fresher") else @@ -190,6 +195,7 @@ class RecruitmentsController < PseudoSessionController "skills" => skills, "infos" => infos, "academics" => academics, + "experiences" => experiences, "recommendations" => recommendations, "data" => { "name" => rp.name, diff --git a/app/models/employee_academic.rb b/app/models/employee_academic.rb index 6f486f1..baff76c 100644 --- a/app/models/employee_academic.rb +++ b/app/models/employee_academic.rb @@ -9,4 +9,14 @@ class EmployeeAcademic field :note, localize: true belongs_to :employee_profile + + def period + if !self.end_date.nil? + period = self.start_date.strftime("%Y/%m/%d") + " ~ " + self.end_date.strftime("%Y/%m/%d") + else + period = self.start_date.strftime("%Y/%m/%d") + " ~ current" + end + period + end + end \ No newline at end of file diff --git a/app/models/employee_experience.rb b/app/models/employee_experience.rb index 8590083..77de5cc 100644 --- a/app/models/employee_experience.rb +++ b/app/models/employee_experience.rb @@ -10,5 +10,13 @@ class EmployeeExperience belongs_to :employee_profile - + def period + if !self.end_date.nil? + period = self.start_date.strftime("%Y/%m/%d") + " ~ " + self.end_date.strftime("%Y/%m/%d") + else + period = self.start_date.strftime("%Y/%m/%d") + " ~ current" + end + period + end + end \ No newline at end of file