Skip to content

Commit

Permalink
Merge pull request #808 from pulibrary/i807_add_scheduler_link_rebased
Browse files Browse the repository at this point in the history
Add scheduler link to staff csv
  • Loading branch information
christinach authored Jun 28, 2024
2 parents c2044f1 + 6af2760 commit f5ad92c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/air_table_staff/csv_builder.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

require 'csv'
module AirTableStaff
# This class is responsible for creating a CSV out of the
# data from Airtable
Expand Down
3 changes: 2 additions & 1 deletion app/models/air_table_staff/staff_directory_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def fields
{ airtable_field: :'Area of Study', our_field: :areasOfStudy, transformer: ->(areas) { areas&.join('//') } },
{ airtable_field: :'Website URL', our_field: :websiteUrl },
{ airtable_field: :Bios, our_field: :bios },
{ airtable_field: :Expertise, our_field: :expertise, transformer: ->(areas) { areas&.join('//') } }
{ airtable_field: :Expertise, our_field: :expertise, transformer: ->(areas) { areas&.join('//') } },
{ airtable_field: :'My Scheduler Link', our_field: :mySchedulerLink }
]
end
# rubocop:enable Metrics/MethodLength
Expand Down
3 changes: 2 additions & 1 deletion spec/fixtures/files/air_table/records_no_offset.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"University Phone": "(123) 123-1234",
"pul:Preferred Name": "Phillip Librarian",
"Email": "[email protected]",
"Bios": "Hello\nMy research interests\nare\n\nfantastic!"
"Bios": "Hello\nMy research interests\nare\n\nfantastic!",
"My Scheduler Link": "https://example.com"
}
}
]
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 @@ -16,12 +16,12 @@
# Since the cell is in in double quotes, it will still be read
# as a single cell within a single row"
expected = <<~END_CSV
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise,mySchedulerLink
123,ab123,(123) 123-1234,Phillip Librarian,Librarian,Phillip,[email protected],123 Stokes,Stokes,Stokes,,,,Library Collections Specialist V,Virtual Reality,,"Hello
My research interests
are
fantastic!",
fantastic!",,https://example.com
END_CSV
directory = described_class.new
expect(directory.to_csv).to eq(expected)
Expand Down
6 changes: 4 additions & 2 deletions spec/models/air_table_staff/staff_directory_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
'Bios': "Kevin has worked at Princeton since 2011. He has a M.S. in Library and Information Science from the University of Illinois at Urbana-Champaign." \
"\n\nKevin heads the Discovery and Access Services Team that supports the Library Catalog. \n",
'Website URL': 'https://github.com/kevinreiss',
'Area of Study': ['Chemistry', 'African American Studies']
'Area of Study': ['Chemistry', 'African American Studies'],
'My Scheduler Link': 'https://example.com'
}
expected = [
'987654321', # puid
Expand All @@ -47,7 +48,8 @@
"from the University of Illinois at Urbana-Champaign."\
"\n\nKevin heads the Discovery and Access Services Team "\
"that supports the Library Catalog. \n", # bios
'Discovery//Library Systems' # expertise
'Discovery//Library Systems', # expertise
'https://example.com' # mySchedulerLink
]

expect(described_class.new(json).to_a).to eq(expected)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/air_table_staff/staff_list_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[
'123', 'ab123', '(123) 123-1234', 'Phillip Librarian', 'Librarian', 'Phillip', '[email protected]',
'123 Stokes', 'Stokes', 'Stokes', nil, nil, nil, 'Library Collections Specialist V', 'Virtual Reality',
nil, "Hello\nMy research interests\nare\n\nfantastic!", nil
nil, "Hello\nMy research interests\nare\n\nfantastic!", nil, 'https://example.com'
]
end

Expand Down

0 comments on commit f5ad92c

Please sign in to comment.