Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/domain/ptime/assign_employee_ids.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def map_employees(should_map)
matched_person = Person.where(ptime_employee_id: nil, ptime_data_provider: nil)
.find_by(email:)

is_employed = ptime_employee[:attributes][:is_employed]
is_employed = ptime_employee[:attributes][:has_relevant_employment]
next record_unmatched_entry(ptime_employee) unless matched_person && is_employed

@mapped_people_count += 1
Expand Down
4 changes: 2 additions & 2 deletions app/domain/ptime/people_employees.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def update_people_data(is_manual_sync: false)
def update_all_people
fetch_data_of_ptime_employees_by_provider.each do |provider, provider_employees|
active_employees, inactive_employees = provider_employees.partition do |ptime_employee|
ptime_employee.dig(:attributes, :is_employed)
ptime_employee.dig(:attributes, :has_relevant_employment)
end
@provider = provider
@update_failed_names[provider] = []
Expand Down Expand Up @@ -82,7 +82,7 @@ def update_directly_mappable_attributes
end

def update_indirectly_mappable_attributes
is_employed = @ptime_employee_attributes[:is_employed]
is_employed = @ptime_employee_attributes[:has_relevant_employment]
@person.company = is_employed ? @employed_company : @unemployed_company
@person.department = Department.find_or_create_by!(
name: @ptime_employee_attributes[:department_name]
Expand Down
2 changes: 1 addition & 1 deletion spec/domain/ptime/people_employees_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
end

def check_person_data_updated(person, employee_data)
is_employed = employee_data[:is_employed]
is_employed = employee_data[:has_relevant_employment]

expect(person.name.eql?(employee_full_name(employee_data))).to eql(is_employed)
expect(person.email.eql?(employee_data[:email])).to eql(is_employed)
Expand Down
6 changes: 3 additions & 3 deletions spec/fixtures/files/json/all_ptime_employees_company.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"graduation" : "Flashing lights",
"city" : "Bern",
"birthday" : "1990-03-10",
"is_employed" : true,
"has_relevant_employment" : true,
"department_shortname" : "UX",
"department_name" : "/ux",
"employment_roles" : [
Expand Down Expand Up @@ -43,7 +43,7 @@
"graduation" : "MSc in writing",
"city" : "Genf",
"birthday" : "2001-01-05",
"is_employed" : true,
"has_relevant_employment" : true,
"department_shortname" : "D3",
"department_name" : "/dev/tre",
"employment_roles" : [
Expand Down Expand Up @@ -73,7 +73,7 @@
"graduation" : "Can't tell me nothing",
"city" : "Thun",
"birthday" : "1980-10-25",
"is_employed" : false,
"has_relevant_employment" : false,
"department_shortname" : "UX",
"department_name" : "/ux",
"employment_roles" : [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"graduation" : "Very interesting graduation",
"city" : "Zürich",
"birthday" : "1990-03-10",
"is_employed" : true,
"has_relevant_employment" : true,
"department_shortname" : "UX",
"department_name" : "/ux",
"employment_roles" : [
Expand Down