diff --git a/app/models/lionpath/lionpath_committee.rb b/app/models/lionpath/lionpath_committee.rb index 395d846b2..83c1ece4e 100644 --- a/app/models/lionpath/lionpath_committee.rb +++ b/app/models/lionpath/lionpath_committee.rb @@ -36,7 +36,7 @@ def self.external_ids private def committee_member_update(committee_member, row, committee_role) - committee_member.update committee_member_attrs(row, committee_role) unless + committee_member.update! committee_member_attrs(row, committee_role) unless committee_member.submission.status_behavior.beyond_waiting_for_final_submission_response_rejected? end @@ -58,7 +58,7 @@ def committee_member_attrs(row, committee_role) end def special_member?(row) - !row['Special Member First Name'].nil? && !row['Special Member Last Name'].nil? + row['Special Member First Name'].present? && row['Special Member Last Name'].present? end def submission(row) diff --git a/spec/models/lionpath/lionpath_committee_spec.rb b/spec/models/lionpath/lionpath_committee_spec.rb index a6464feaf..92fa76534 100644 --- a/spec/models/lionpath/lionpath_committee_spec.rb +++ b/spec/models/lionpath/lionpath_committee_spec.rb @@ -14,7 +14,8 @@ let(:row) do { 'Access ID' => 'abc123', 'Last Name' => 'Tester', 'First Name' => 'Test', 'Role' => 'C', 'Committee' => 'DOCCM', 'Committee Long Descr' => 'Chair of Committee', 'Student ID' => '999999999', - 'Student Campus ID' => 'def123', 'Suprvsr Nbr' => '932352541' } + 'Student Campus ID' => 'def123', 'Suprvsr Nbr' => '932352541', 'Special Member First Name' => '', + 'Special Member Last Name' => '' } end context "when author's submission's year is before 2021" do @@ -110,7 +111,8 @@ let(:row2) do { 'Access ID' => 'mgc25', 'Last Name' => 'Committee', 'First Name' => 'Member', 'Role' => 'S', 'Committee' => 'DOCCM', 'Committee Long Descr' => 'Special Member', 'Student ID' => '999999999', - 'Student Campus ID' => 'def123', 'Suprvsr Nbr' => '932352541' } + 'Student Campus ID' => 'def123', 'Suprvsr Nbr' => '932352541', 'Special Member First Name' => 'Special', + 'Special Member Last Name' => 'Person' } end context 'when the committee member does not yet exist in the db' do @@ -118,6 +120,7 @@ expect { lionpath_committee.import(row2) }.to change { submission.committee_members.count }.by 1 expect(submission.committee_members.last.access_id).to eq 'mgc25' expect(submission.committee_members.last.external_to_psu_id).to eq 'mgc25' + expect(submission.committee_members.last.name).to eq 'Special Person' end end