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

Fix LP Export #841

Merged
merged 2 commits into from
Sep 13, 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
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