Skip to content

Commit

Permalink
[#236] Update library_staff_record to gsub other_entities and areas_o…
Browse files Browse the repository at this point in the history
…f_study

Now you can search or display other_entities and areas_of_study
Include new fields in the csv loading header
Update library staff record spec with new query for other_entities

Co-authored-by: Jane Sandberg <[email protected]>
  • Loading branch information
christinach and sandbergja committed Jul 18, 2024
1 parent 23f7c34 commit 55002c5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/models/library_staff_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def self.new_from_csv(row)
record.building = row[8]
record.department = row[9]
record.unit = row[11]
record.areas_of_study = row[14]&.split('//')
record.areas_of_study = row[14]&.gsub('//', ', ')
record.my_scheduler_link = row[18]
record.other_entities = row[19]&.split('//')
record.other_entities = row[19]&.gsub('//', ', ')
record.library_title = title
record.title = title
record.save! if record.valid?
Expand Down
2 changes: 1 addition & 1 deletion app/services/library_staff_loading_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def class_to_load

def expected_headers
%w[puid netid phone name lastName firstName email address building department division
unit team title areasOfStudy websiteUrl bios expertise mySchedulerLink]
unit team title areasOfStudy websiteUrl bios expertise mySchedulerLink otherEntities]
end

def uri
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise,mySchedulerLink
,,,,,,,,,,,,,,,,,,
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",[email protected],Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,,
,,,,,,,,,,,,,,,,,,
puid,netid,phone,name,lastName,firstName,email,address,building,department,division,unit,team,title,areasOfStudy,websiteUrl,bios,expertise,mySchedulerLink,otherEntities
,,,,,,,,,,,,,,,,,,,
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",[email protected],Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,,,
,,,,,,,,,,,,,,,,,,,
10 changes: 5 additions & 5 deletions spec/fixtures/files/library_staff/staff-directory.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"puid","netid","phone","name","lastName","firstName",email,address,building,department,division,unit,team,"title","areasOfStudy","websiteUrl","bios","expertise","mySchedulerLink"
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",[email protected],Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,,
"000000002","nimbuskt","(555) 111-1111","Trout, Nimbus","Trout","Nimbus Kilgore",[email protected],A-200,Firestone Library,Office of the Deputy Dean of Libraries,Information Technology,IT Operations and Digitization,,"Nap Coordinator","Naps//Coordination",,,,
"000000003","tiberius","(555) 222-2222","Adams, Tiberius","Adams","Spot Tiberius",[email protected],B-300,Firestone Library,My Department,Library - Collections and Access Services,Access & Fulfillment Services,,"Lead Hairball Engineer",,,,,
"000000010","brutus","(555) 222-2222","Cat, Brutus","Cat","Brutus The",[email protected],B-300,Stokes Library,My Department,Library - Collections and Access Services,PCRP - Physical Collections Receipt & Processing Unit,,"Fluffiest cat",,,,,
"puid","netid","phone","name","lastName","firstName",email,address,building,department,division,unit,team,"title","areasOfStudy","websiteUrl","bios","expertise","mySchedulerLink","otherEntities"
"000000001","lucyfs","(555) 123-1234","Stardust, Lucy","Stardust","Lucy Fae",[email protected],Forrestal,Recap Library,Office of the Deputy Dean of Libraries,Facilities,,,"Pest Removal Specialist",,,,,,"MS Chadha Center for Global India"
"000000002","nimbuskt","(555) 111-1111","Trout, Nimbus","Trout","Nimbus Kilgore",[email protected],A-200,Firestone Library,Office of the Deputy Dean of Libraries,Information Technology,IT Operations and Digitization,,"Nap Coordinator","Naps//Coordination",,,,,"Center for Culture, Society and Religion//University Center for Human Values"
"000000003","tiberius","(555) 222-2222","Adams, Tiberius","Adams","Spot Tiberius",[email protected],B-300,Firestone Library,My Department,Library - Collections and Access Services,Access & Fulfillment Services,,"Lead Hairball Engineer",,,,,,"Center for International Security Studies (CISS)//Center for the Study of Democratic Politics (CSDP)//Empirical Studies of Conflict (ESOC)//Innovations for Successful Societies (ISS)//Liechtenstein Institute on Self-Determination (LISD)//Niehaus Center for lization and Governance (NCGG)//Princeton Survey Research Center (SRC)//Research Program in Political Economy (RPPE)"
"000000010","brutus","(555) 222-2222","Cat, Brutus","Cat","Brutus The",[email protected],B-300,Stokes Library,My Department,Library - Collections and Access Services,PCRP - Physical Collections Receipt & Processing Unit,,"Fluffiest cat",,,,,,
5 changes: 5 additions & 0 deletions spec/models/library_staff_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@
expect(results[0].first_name).to eq('Nimbus Kilgore')
expect(results[1].first_name).to eq('Spot Tiberius')
end
it "finds records by other entities" do
results = described_class.query('Center for Global')
expect(results.length).to eq(1)
expect(results[0].other_entities).to eq('MS Chadha Center for Global India')
end
end
end

0 comments on commit 55002c5

Please sign in to comment.