Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consolidate program names during solr import #789

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion app/models/solr_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def field_semantics
degree_type_slug: ['degree_type_slug_ssi'],
degree_type_name: ['degree_type_ssi'],
legacy_id: 'db_legacy_id',
program_name: ['program_name_tesi', 'program_name_ssi'],
program_name_condensed: ['program_name_tesi', 'program_name_ssi'],
committee_member_names: ['committee_member_name_ssim', 'committee_member_name_tesim'],
committee_member_emails: ['committee_member_email_ssim'],
committee_member_and_role: ['committee_member_and_role_tesim', 'committee_member_role_ssim'],
Expand Down Expand Up @@ -111,4 +111,8 @@ def final_submission_file_isim
end
files
end

def program_name_condensed
program_name.gsub(/ \(MS\)| \(PHD\)/, '')
end
end
9 changes: 6 additions & 3 deletions spec/models/solr_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
# Test that datetime converts to UTC
final_submission_files_uploaded_at: DateTime.now,
# Test that nil stays nil
defended_at: nil
defended_at: nil,
program_id: program.id
end
let(:final_submission_file_1) { create :final_submission_file }
let(:final_submission_file_2) { create :final_submission_file }
let(:format_review_file) { create :format_review_file }
let(:committee_member_1) { create :committee_member }
let(:committee_member_2) { create :committee_member }
let(:program) { create :program, name: 'Mechanical Engineering (MS)' }
let(:program_name_condensed) { 'Mechanical Engineering' }

it 'generates solr doc from submission attributes' do
submission.committee_members << committee_member_1
Expand Down Expand Up @@ -62,8 +65,8 @@
"last_name_ssi" => submission.author_last_name,
"last_name_tesi" => submission.author_last_name,
"middle_name_ssi" => submission.author_middle_name,
"program_name_ssi" => submission.program_name,
"program_name_tesi" => submission.program_name,
"program_name_ssi" => program_name_condensed,
"program_name_tesi" => program_name_condensed,
"released_metadata_at_dtsi" => submission.released_metadata_at.to_datetime.getutc,
"semester_ssi" => submission.semester,
"title_ssi" => submission.title,
Expand Down