Skip to content

Commit

Permalink
Handle existing applications
Browse files Browse the repository at this point in the history
This updates the qualification verification tasks to handle the case
where the qualification has gone out without consent being selected.
  • Loading branch information
thomasleese committed Mar 21, 2024
1 parent 805e170 commit 53c0dae
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions app/lib/application_form_status_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,18 @@ def need_to_request_lops?
end

def need_to_request_consent?
qualification_requests.any?(&:consent_method_unknown?) ||
consent_requests.any?(&:not_requested?)
(
qualification_requests.none?(&:requested?) &&
qualification_requests.any?(&:consent_method_unknown?)
) || consent_requests.any?(&:not_requested?)
end

def need_to_request_ecctis?
qualification_requests
.select(&:not_requested?)
.any? do |qualification_request|
qualification_request.consent_method_unsigned? ||
qualification_request.consent_method_none? ||
qualification_request.consent_method_unsigned? ||
consent_requests
.select(&:verify_passed?)
.any? do |consent_request|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def all_task_items
end

def all_consent_methods_selected?
qualification_requests.none?(&:consent_method_unknown?)
qualification_requests.none?(&:consent_method_unknown?) ||
qualification_requests.requested.exists?
end

def show_individual_task_items?
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/example_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,13 @@ def create_application_forms
:selected_failure_reason,
:fi_requestable,
assessment_section: assessment.sections.first,
key: assessment.sections.first.failure_reasons.sample,
)
FactoryBot.create(
:selected_failure_reason,
:declinable,
assessment_section: assessment.sections.second,
key: assessment.sections.second.failure_reasons.sample,
)

declined_at = Faker::Time.between(from: 6.months.ago, to: Time.zone.now)
Expand Down
8 changes: 7 additions & 1 deletion spec/system/assessor_interface/completing_assessment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
then_i_see_the(:assessor_application_status_page, reference:)

when_i_click_on_overview_button
then_the_application_form_is_waiting_on
then_the_application_form_is_verification_in_progress
end

it "decline" do
Expand Down Expand Up @@ -437,6 +437,12 @@ def then_the_application_form_is_waiting_on
)
end

def then_the_application_form_is_verification_in_progress
expect(assessor_application_page.status_summary.value.text).to include(
"VERIFICATION IN PROGRESS",
)
end

def then_the_application_form_is_declined
expect(assessor_application_page.status_summary.value).to have_text(
"DECLINED",
Expand Down

0 comments on commit 53c0dae

Please sign in to comment.