recruitment/app/models/recruitment_job.rb

83 lines
2.8 KiB
Ruby
Raw Normal View History

2017-12-21 19:41:50 +00:00
class RecruitmentJob
include Mongoid::Document
include Mongoid::Timestamps
include Slug
field :post_type #type1 => Job, type2 => Internship, type3 => Exchange
2017-12-21 19:41:50 +00:00
field :job_title, as: :slug_title, localize: true
field :job_description, localize: true
field :responsibility, localize: true
field :other_conditions, localize: true
field :salary #type1 => negotiable type2 => according to company rules
2017-12-21 19:41:50 +00:00
field :travel_assignment #type1 => Need to travel, type2 => occasionally, type3 => travelling not required
field :working_time #type1 => Day Shift, type2 => Night Shift
field :holiday_system #type1 => According to Company Rules, type2 => other
field :holiday_system_other
field :joining_time #type1 => Immediate, type2 => withing week, type3 => within a month, type4 => more than a month
field :work_type #type1 => Office worker, type2 => graduate, type3 => foreigner, type4 => internship, type5 => SOHO
field :work_experience_years, type: Integer, :default => 0
field :work_experience_months, type: Integer, :default => 0
2017-12-21 19:41:50 +00:00
field :academic_requirement
field :language_requirement
field :skills, type: Array, :default => []
2017-12-21 19:41:50 +00:00
field :category
field :location_of_work
field :industrial_area
field :academic_type #type1 -> bachelors, type2 -> masters, type3 -> phd, type4 -> course
field :min_salary, type: Integer, :default => 0
field :max_salary, type: Integer, :default => 0
2018-01-15 12:26:18 +00:00
# internship
field :part_time, type: Boolean, :default => false
field :internship_duration, type: Integer, :default => 0
field :perks #type1 => certificate, type2 => placement offer, type3 => informal dress code
2018-01-16 12:06:04 +00:00
#exchanges
field :exchange_start_date, type: DateTime
field :min_credit_score, type: Integer, :default => 0
2017-12-21 19:41:50 +00:00
field :filled, type: Boolean, :default => false
belongs_to :employer_profile
scope :not_filled, ->{where(:filled => false)}
2018-01-17 18:22:24 +00:00
scope :filled, ->{where(:filled => true)}
2018-01-15 12:26:18 +00:00
scope :jobs, ->{where(:post_type => "type1")}
scope :internships, ->{where(:post_type => "type2")}
2018-01-17 18:22:24 +00:00
scope :exchanges, ->{where(:post_type => "type3")}
def get_category
RecruitmentCategory.find(self.category).job_category rescue ""
end
2017-12-21 19:41:50 +00:00
def get_application_count
EmployeeJobApplication.where(:job => self.id.to_s).not_archived.count
end
2018-01-15 12:26:18 +00:00
def get_post_type_label
case self.post_type
when "type1"
"<span class='label label-primary'>#{I18n.t("recruitment.post_t.type1")}</span>"
when "type2"
"<span class='label label-info'>#{I18n.t("recruitment.post_t.type2")}</span>"
when "type3"
"<span class='label label-warning'>#{I18n.t("recruitment.post_t.type3")}</span>"
end
end
2018-01-17 18:22:24 +00:00
def get_job_page
case self.post_type
when "type1"
"jobs"
when "type2"
"internships"
when "type3"
"exchanges"
end
end
2017-12-21 19:41:50 +00:00
end