Skip to content

Commit

Permalink
Add Title to staff csv
Browse files Browse the repository at this point in the history
Closes #797
  • Loading branch information
maxkadel committed Jun 24, 2024
1 parent 45ba1d4 commit 87c0dc1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/models/air_table_staff/staff_directory_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def fields
{ airtable_field: :'pul:Department', our_field: :division },
{ airtable_field: :'pul:Unit', our_field: :unit },
{ airtable_field: :'pul:Team', our_field: :team },
{ airtable_field: :Title, our_field: :title },
{ airtable_field: :'Area of Study', our_field: :areasOfStudy, transformer: ->(areas) { areas&.join('//') } }
]
end
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/air_table/records_no_offset.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"pul:Building": "Stokes",
"Last Name": "Librarian",
"First Name": "Phillip",
"Title": "Library Collections Specialist V",
"University ID": "123",
"netid": "ab123",
"University Phone": "(123) 123-1234",
Expand Down
4 changes: 2 additions & 2 deletions spec/models/air_table_staff/csv_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
end
it 'creates a CSV object with data from the HTTP API' do
expected = <<~END_CSV
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,areasOfStudy
123,ab123,(123) 123-1234,Phillip Librarian,Librarian,Phillip,[email protected],123 Stokes,Stokes,Stokes,,,,Virtual Reality
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy
123,ab123,(123) 123-1234,Phillip Librarian,Librarian,Phillip,[email protected],123 Stokes,Stokes,Stokes,,,,Library Collections Specialist V,Virtual Reality
END_CSV
directory = described_class.new
expect(directory.to_csv).to eq(expected)
Expand Down
2 changes: 2 additions & 0 deletions spec/models/air_table_staff/staff_directory_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'pul:Department': 'Cataloging and Metadata Services',
'pul:Unit': 'Rare Books Cataloging Team',
'pul:Team': 'IT, Discovery and Access Services',
'Title': 'Library Software Engineer',
'Area of Study': ['Chemistry', 'African American Studies']
}
expected = [
Expand All @@ -34,6 +35,7 @@
'Cataloging and Metadata Services', # division
'Rare Books Cataloging Team', # unit
'IT, Discovery and Access Services', # team
'Library Software Engineer', # title
'Chemistry//African American Studies' # areasOfStudy
]

Expand Down
3 changes: 2 additions & 1 deletion spec/models/air_table_staff/staff_list_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
let(:file_path) { Pathname.new(Rails.root.join('tmp', "airtable_staff.csv")) }
let(:first_row) do
[
'123', 'ab123', '(123) 123-1234', 'Phillip Librarian', 'Librarian', 'Phillip', '[email protected]', '123 Stokes', 'Stokes', 'Stokes', nil, nil, nil, 'Virtual Reality'
'123', 'ab123', '(123) 123-1234', 'Phillip Librarian', 'Librarian', 'Phillip', '[email protected]',
'123 Stokes', 'Stokes', 'Stokes', nil, nil, nil, 'Library Collections Specialist V', 'Virtual Reality'
]
end

Expand Down

0 comments on commit 87c0dc1

Please sign in to comment.