diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index ea165865f..88484af68 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -32,15 +32,12 @@ def show def new @person = Ptime::PeopleEmployees.new.create_or_find(params[:ptime_employee_id]) - # (%w[DE EN FR] - @person.language_skills.pluck(:language)).each do |language| - # @person.language_skills.push(LanguageSkill.new({ language: language, level: 'A1' })) - # end redirect_to(@person) # %w[DE EN FR].each do |language| # @person.language_skills.push(LanguageSkill.new({ language: language, level: 'A1' })) # end - #super + # super end def create diff --git a/app/domain/ptime/people_employees.rb b/app/domain/ptime/people_employees.rb index 103efb68c..96a2e645e 100644 --- a/app/domain/ptime/people_employees.rb +++ b/app/domain/ptime/people_employees.rb @@ -6,7 +6,11 @@ def create_or_find(ptime_employee_id) person = Person.find_by(ptime_employee_id: ptime_employee_id) return person unless person.nil? - update_person_data(Person.new(ptime_employee_id: ptime_employee_id)) + new_person = Person.new(ptime_employee_id: ptime_employee_id) + %w[DE EN FR].each do |language| + new_person.language_skills.push(LanguageSkill.new({ language: language, level: 'A1' })) + end + update_person_data(new_person) end # rubocop:disable Metrics