-
Notifications
You must be signed in to change notification settings - Fork 1
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
Handle navigating past the country page after selecting an ineligible… #1769
Handle navigating past the country page after selecting an ineligible… #1769
Conversation
e7fe7e7
to
db3c2c6
Compare
Review app deployed to https://apply-for-qts-review-1769-web.test.teacherservices.cloud/personas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
@@ -18,6 +22,11 @@ def current_page_is_allowed? | |||
current_position && order && current_position <= order | |||
end | |||
|
|||
def ineligible_application_without_skip_additional_questions | |||
eligibility_check&.status == :eligibility && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eligibility_check&.status == :eligibility && | |
eligibility_check&.status == :eligibility |
The status of :eligibility
includes both eligible and ineligible checks - if the check is eligible I don't think we want to redirect to the ineligible page.
if request.path != eligibility_interface_countries_path && | ||
ineligible_application_without_skip_additional_questions | ||
redirect_to eligibility_interface_ineligible_path | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is the right place to put this logic as this class shouldn't be concerned about the specifics of skipping additional questions, that's already handled by the status
method so we don't want to be duplicating ourselves here (
apply-for-qualified-teacher-status/app/models/eligibility_check.rb
Lines 150 to 160 in 13d4dd3
unless skip_additional_questions? | |
return :degree if degree.nil? | |
return :teach_children if teach_children.nil? | |
if qualified_for_subject_required? && qualified_for_subject.nil? | |
return :qualified_for_subject | |
end | |
return :work_experience if work_experience.blank? | |
return :misconduct if free_of_sanctions.nil? | |
end |
We also don't want to be just checking for this case when we're not on the countries path. Although at the moment this is only place we can get this sort of out-of-order issue, we should build this class in a generic way that allows it to work for any potential issues in the future.
The logic as written here also introduces a bug where users will get redirected to the ineligible page if they're eligible, skips additional questions and not on the countries path.
If there's an ineligible check we don't want to allow users to access other pages of the eligibility checker.
I've renamed this to ResultController and simplified some of the logic.
db3c2c6
to
f817f1f
Compare
… country
https://dfe-teacher-services.sentry.io/issues/3910860876/?project=6426061&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=14d&stream_index=2
We’ve got reports of this issue in Sentry, only happened 29 times and only seems to happen every few weeks, but we should investigate and fix the issue.
What happens if eligibility_check.status is something that_ isn’t _in paths.keys ?https://github.com/DFE-Digital/apply-for-qualified-teacher-status/blob/8cd32f1b31c[…]/app/controllers/concerns/enforce_eligibility_question_order.rb
Because there is one case where the region can be nil and the status will be something not in the list:
apply-for-qualified-teacher-status/app/models/eligibility_check.rb
Line 145 in 8cd32f1
Reproducing the issue pre fix:
The steps are:
Start the eligibility checker
Choose an ineligible country (e.g. North Korea)
Ignore the ineligible result and go to the /eligibility/work-experience page
In that case we’ve got an eligibility check where region is nil , the status is :eligibility so it passes the order enforcement logic
The solution I've implemented is to check that the applicant is ineligible and redirect to the ineligible page if so. The applicant can still navigate to the country page.