Skip to content

Commit

Permalink
Add method for checking if ptime is available and append first and la…
Browse files Browse the repository at this point in the history
…stname to person
  • Loading branch information
ManuelMoeri committed Feb 21, 2025
1 parent a379c21 commit 261a473
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/domain/ptime/people_employees.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def set_additional_attributes(person, ptime_employee)
person.nationality = ptime_employee_nationalities[0]
person.nationality2 = ptime_employee_nationalities[1]

first_name = ptime_employee[:attributes][:firstname].presence || ''
last_name = ptime_employee[:attributes][:lastname].presence || ''
person[:name] = "#{first_name} #{last_name}".strip

# temporary until the Ptime API gets updated
person.birthdate = DateTime.new(2000, 2, 3)
person.location = 'Boston, MA'
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/person_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,8 @@ def build_dropdown_data(ptime_employees)
def append_ptime_employee_name(ptime_employee)
"#{ptime_employee[:attributes][:firstname]} #{ptime_employee[:attributes][:lastname]}"
end

def ptime_api_available?
Skills.ptime_available?
end
end
8 changes: 5 additions & 3 deletions app/views/people/_search.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
= select :person_id, :person, options_for_select(sorted_people, select_when_available(person)), {prompt: person.nil?}, {data: { "dropdown-target" => "dropdown", action: "change->dropdown#handleChange"}}
%div.d-flex.align-items-center.text-gray
= "#{t 'profile.updated_at'}: #{@person&.last_updated_at.strftime("%d.%m.%Y")}" if @person&.last_updated_at
%a.d-flex.justify-content-between#new-person-button{href: "/people/new"}
%img.pe-1{src: "/assets/plus-lg.svg"}
Neues Profil

- unless ptime_api_available?
%a.d-flex.justify-content-between#new-person-button{href: "/people/new"}
%img.pe-1{src: "/assets/plus-lg.svg"}
Neues Profil

0 comments on commit 261a473

Please sign in to comment.