Skip to content

Commit

Permalink
Fix LP Export (#841)
Browse files Browse the repository at this point in the history
* Instead of checking approval status for candAdv, simply check that we are not at the committee review rejected stage

* Rubocop
  • Loading branch information
ajkiessl authored Sep 13, 2024
1 parent c492716 commit 64d0618
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
3 changes: 2 additions & 1 deletion app/models/lionpath/lionpath_export_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def final_submission_approved
end

def core_committee_approved
return "Y" if status_behavior.beyond_waiting_for_committee_review? && committee_approved_status?
return "Y" if status_behavior.beyond_waiting_for_committee_review? &&
!status_behavior.waiting_for_committee_review_rejected?

nil
end
Expand Down
21 changes: 9 additions & 12 deletions spec/models/lionpath/lionpath_export_payload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
allow(status_behavior).to receive(:beyond_waiting_for_final_submission_response?).and_return(false)
allow(status_behavior).to receive(:beyond_waiting_for_committee_review_rejected?).and_return(false)
allow(status_behavior).to receive(:beyond_waiting_for_final_submission_response_rejected?).and_return(false)
allow(status_behavior).to receive(:waiting_for_committee_review_rejected?).and_return(false)
end

it 'returns JSON formatted object' do
Expand All @@ -45,7 +46,7 @@
expect(export_payload.json_payload).to eq(expected_payload)
end

context 'when thesis is beyond_collecting_format_review_files but not beyond_waiting_for_final_submission_response' do
context 'when the submission is beyond_collecting_format_review_files but not beyond_waiting_for_final_submission_response' do
it 'sets thesisStatus to SUBMITTED' do
payload = JSON.parse(export_payload.json_payload)
expect(payload["PE_SR199_ETD_REQ"]["thesisStatus"]).to eq("SUBMITTED")
Expand All @@ -57,7 +58,7 @@
end
end

context 'when thesis is beyond_waiting_for_final_submission_response' do
context 'when the submission is beyond_waiting_for_final_submission_response' do
before do
allow(status_behavior).to receive(:beyond_waiting_for_final_submission_response?).and_return(true)
end
Expand All @@ -68,7 +69,7 @@
end
end

context 'when thesis is beyond_waiting_for_committee_review_rejected' do
context 'when the submission is beyond_waiting_for_committee_review_rejected' do
before do
allow(status_behavior).to receive(:beyond_waiting_for_committee_review_rejected?).and_return(true)
end
Expand Down Expand Up @@ -102,25 +103,21 @@
end
end

context 'when thesis is beyond_waiting_for_committee_review ' do
context 'when the submission is beyond_waiting_for_committee_review' do
before do
allow(status_behavior).to receive(:beyond_waiting_for_committee_review?).and_return(true)
end

context "when the committee approval status is '#{ApprovalStatus::APPROVED_STATUS}'" do
before do
allow(approval_status_behavior).to receive(:status).and_return ApprovalStatus::APPROVED_STATUS
end

context "when the submission is not waiting_for_committee_review_rejected" do
it 'sets candAdvFlg to Y' do
payload = JSON.parse(export_payload.json_payload)
expect(payload["PE_SR199_ETD_REQ"]["candAdvFlg"]).to eq("Y")
end
end

context "when the committee approval status is not '#{ApprovalStatus::APPROVED_STATUS}'" do
context "when the submission is waiting_for_committee_review_rejected" do
before do
allow(approval_status_behavior).to receive(:status).and_return ApprovalStatus::REJECTED_STATUS
allow(status_behavior).to receive(:waiting_for_committee_review_rejected?).and_return(true)
end

it 'does not set candAdvFlg' do
Expand All @@ -130,7 +127,7 @@
end
end

context 'when thesis is beyond_waiting_for_final_submission_response_rejected' do
context 'when the submission is beyond_waiting_for_final_submission_response_rejected' do
before do
allow(status_behavior).to receive(:beyond_waiting_for_final_submission_response_rejected?).and_return(true)
end
Expand Down

0 comments on commit 64d0618

Please sign in to comment.