Skip to content

Commit

Permalink
Merge pull request #833 from pulibrary/i832_add_pronouns_to_csv
Browse files Browse the repository at this point in the history
Add pronouns to staff directory mapping
  • Loading branch information
christinach authored Aug 13, 2024
2 parents 70ed760 + 0817d6d commit 5a676d5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
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 @@ -32,7 +32,8 @@ def fields
{ airtable_field: :Bios, airtable_field_id: :fld4JloN0LxiFaTiw, our_field: :bios },
{ airtable_field: :Expertise, airtable_field_id: :fldypTXdkQGpYgVDC, our_field: :expertise, transformer: ->(expertises) { expertises&.join('//') } },
{ airtable_field: :'My Scheduler Link', airtable_field_id: :fldULoOUDSpoEpdAP, our_field: :mySchedulerLink },
{ airtable_field: :'Other Entities', airtable_field_id: :fldXw9janMHvhBWvO, our_field: :otherEntities, transformer: ->(entities) { entities&.join('//') } }
{ airtable_field: :'Other Entities', airtable_field_id: :fldXw9janMHvhBWvO, our_field: :otherEntities, transformer: ->(entities) { entities&.join('//') } },
{ airtable_field: :Pronouns, airtable_field_id: :fldavR3Hqxd7igWxB, our_field: :pronouns }
]
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 @@ -19,7 +19,8 @@
"fldbnDHHhDNlc2Lx8": "[email protected]",
"fld4JloN0LxiFaTiw": "Hello\nMy research interests\nare\n\nfantastic!",
"fldULoOUDSpoEpdAP": "https://example.com",
"fldXw9janMHvhBWvO": ["Industrial Relations", "James Madison Program"]
"fldXw9janMHvhBWvO": ["Industrial Relations", "James Madison Program"],
"fldavR3Hqxd7igWxB": "he/him/his"
}
}
]
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 @@ -10,12 +10,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,mySchedulerLink,otherEntities
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise,mySchedulerLink,otherEntities,pronouns
123,ab123,(123) 123-1234,Phillip Librarian,Librarian,Phillip,[email protected],123 Stokes,Stokes,Special Collections,Special and Distinctive Collections,,,Library Collections Specialist V,Virtual Reality,,"Hello
My research interests
are
fantastic!",,https://example.com,Industrial Relations//James Madison Program
fantastic!",,https://example.com,Industrial Relations//James Madison Program,he/him/his
END_CSV
directory = described_class.new
expect(directory.to_csv).to eq(expected)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/air_table_staff/record_list_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'rails_helper'

BASE_AIRTABLE_URL = 'https://api.airtable.com/v0/appv7XA5FWS7DG9oe/tblM0iymGN5oqDUVm?fields%5B%5D=fld0MfgMlZd364YTR&fields%5B%5D=fld4JloN0LxiFaTiw&fields%5B%5D=fld9NYFQePrPxbJJW&fields%5B%5D=fldCCTbVNKKBFXxrp&fields%5B%5D=fldGzh0SHZqlFk3aU&fields%5B%5D=fldKZxmtofNbXW4qS&fields%5B%5D=fldnKprqGraSvNTJK&fields%5B%5D=fldL7tm4jVvYksIwl&fields%5B%5D=fldULoOUDSpoEpdAP&fields%5B%5D=fldXw9janMHvhBWvO&fields%5B%5D=fldbnDHHhDNlc2Lx8&fields%5B%5D=fldbquJ6Hn2eq1V2h&fields%5B%5D=fldvENk2uiLDHmYSw&fields%5B%5D=fldgarsg3FzD8xpE4&fields%5B%5D=fldqulY6ehd5aIbR1&fields%5B%5D=fldusiuPpfSql6vSk&fields%5B%5D=fldw0mjDdB48HstnB&fields%5B%5D=fldxpCzkJmhEkVqZt&fields%5B%5D=fldypTXdkQGpYgVDC&fields%5B%5D=fldz6yBenvTjdClXZ&returnFieldsByFieldId=true'
BASE_AIRTABLE_URL = 'https://api.airtable.com/v0/appv7XA5FWS7DG9oe/tblM0iymGN5oqDUVm?fields%5B%5D=fld0MfgMlZd364YTR&fields%5B%5D=fld4JloN0LxiFaTiw&fields%5B%5D=fld9NYFQePrPxbJJW&fields%5B%5D=fldCCTbVNKKBFXxrp&fields%5B%5D=fldGzh0SHZqlFk3aU&fields%5B%5D=fldKZxmtofNbXW4qS&fields%5B%5D=fldL7tm4jVvYksIwl&fields%5B%5D=fldULoOUDSpoEpdAP&fields%5B%5D=fldXw9janMHvhBWvO&fields%5B%5D=fldavR3Hqxd7igWxB&fields%5B%5D=fldbnDHHhDNlc2Lx8&fields%5B%5D=fldbquJ6Hn2eq1V2h&fields%5B%5D=fldgarsg3FzD8xpE4&fields%5B%5D=fldnKprqGraSvNTJK&fields%5B%5D=fldqulY6ehd5aIbR1&fields%5B%5D=fldusiuPpfSql6vSk&fields%5B%5D=fldvENk2uiLDHmYSw&fields%5B%5D=fldw0mjDdB48HstnB&fields%5B%5D=fldxpCzkJmhEkVqZt&fields%5B%5D=fldypTXdkQGpYgVDC&fields%5B%5D=fldz6yBenvTjdClXZ&returnFieldsByFieldId=true'

RSpec.describe AirTableStaff::RecordList do
context 'when the airtable response is not paginated' do
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 @@ -25,7 +25,8 @@
'fld0MfgMlZd364YTR': 'https://github.com/kevinreiss',
'fldCCTbVNKKBFXxrp': ['Chemistry', 'African American Studies'],
'fldULoOUDSpoEpdAP': 'https://example.com',
'fldXw9janMHvhBWvO': ['Industrial Relations', 'James Madison Program']
'fldXw9janMHvhBWvO': ['Industrial Relations', 'James Madison Program'],
'fldavR3Hqxd7igWxB': 'he/him'
}
expected = [
'987654321', # puid
Expand All @@ -51,7 +52,8 @@
"that supports the Library Catalog. \n", # bios
'Discovery//Library Systems', # expertise
'https://example.com', # mySchedulerLink
'Industrial Relations//James Madison Program' # otherEntities
'Industrial Relations//James Madison Program', # otherEntities
'he/him'
]

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 @@ -17,7 +17,7 @@
[
'123', 'ab123', '(123) 123-1234', 'Phillip Librarian', 'Librarian', 'Phillip', '[email protected]',
'123 Stokes', 'Stokes', 'Special Collections', 'Special and Distinctive Collections', nil, nil, 'Library Collections Specialist V', 'Virtual Reality',
nil, "Hello\nMy research interests\nare\n\nfantastic!", nil, 'https://example.com', 'Industrial Relations//James Madison Program'
nil, "Hello\nMy research interests\nare\n\nfantastic!", nil, 'https://example.com', 'Industrial Relations//James Madison Program', 'he/him/his'
]
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/stub_airtable.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module AirtableStubbing
BASE_AIRTABLE_URL = "https://api.airtable.com/v0/appv7XA5FWS7DG9oe/tblM0iymGN5oqDUVm?fields%5B%5D=fld0MfgMlZd364YTR&fields%5B%5D=fld4JloN0LxiFaTiw&fields%5B%5D=fld9NYFQePrPxbJJW&fields%5B%5D=fldCCTbVNKKBFXxrp&fields%5B%5D=fldGzh0SHZqlFk3aU&fields%5B%5D=fldKZxmtofNbXW4qS&fields%5B%5D=fldnKprqGraSvNTJK&fields%5B%5D=fldL7tm4jVvYksIwl&fields%5B%5D=fldULoOUDSpoEpdAP&fields%5B%5D=fldXw9janMHvhBWvO&fields%5B%5D=fldbnDHHhDNlc2Lx8&fields%5B%5D=fldbquJ6Hn2eq1V2h&fields%5B%5D=fldvENk2uiLDHmYSw&fields%5B%5D=fldgarsg3FzD8xpE4&fields%5B%5D=fldqulY6ehd5aIbR1&fields%5B%5D=fldusiuPpfSql6vSk&fields%5B%5D=fldw0mjDdB48HstnB&fields%5B%5D=fldxpCzkJmhEkVqZt&fields%5B%5D=fldypTXdkQGpYgVDC&fields%5B%5D=fldz6yBenvTjdClXZ&returnFieldsByFieldId=true"
BASE_AIRTABLE_URL = "https://api.airtable.com/v0/appv7XA5FWS7DG9oe/tblM0iymGN5oqDUVm?fields%5B%5D=fld0MfgMlZd364YTR&fields%5B%5D=fld4JloN0LxiFaTiw&fields%5B%5D=fld9NYFQePrPxbJJW&fields%5B%5D=fldCCTbVNKKBFXxrp&fields%5B%5D=fldGzh0SHZqlFk3aU&fields%5B%5D=fldKZxmtofNbXW4qS&fields%5B%5D=fldL7tm4jVvYksIwl&fields%5B%5D=fldULoOUDSpoEpdAP&fields%5B%5D=fldXw9janMHvhBWvO&fields%5B%5D=fldavR3Hqxd7igWxB&fields%5B%5D=fldbnDHHhDNlc2Lx8&fields%5B%5D=fldbquJ6Hn2eq1V2h&fields%5B%5D=fldgarsg3FzD8xpE4&fields%5B%5D=fldnKprqGraSvNTJK&fields%5B%5D=fldqulY6ehd5aIbR1&fields%5B%5D=fldusiuPpfSql6vSk&fields%5B%5D=fldvENk2uiLDHmYSw&fields%5B%5D=fldw0mjDdB48HstnB&fields%5B%5D=fldxpCzkJmhEkVqZt&fields%5B%5D=fldypTXdkQGpYgVDC&fields%5B%5D=fldz6yBenvTjdClXZ&returnFieldsByFieldId=true"
def stub_airtable(offset: false, empty: false)
if offset
stub_airtable_with_offset
Expand Down

0 comments on commit 5a676d5

Please sign in to comment.