Skip to content

CAPT 2793 year2 reapply#4136

Closed
raul-gracia wants to merge 5 commits intomasterfrom
CAPT-2793-year2-reapply
Closed

CAPT 2793 year2 reapply#4136
raul-gracia wants to merge 5 commits intomasterfrom
CAPT-2793-year2-reapply

Conversation

@raul-gracia
Copy link
Contributor

  • Add Year 2 provider verification auto-pass logic
  • Fix test failures for Year 2 provider verification

@raul-gracia raul-gracia added the deploy Deploy a review app for this PR label Oct 8, 2025
@raul-gracia raul-gracia force-pushed the CAPT-2793-year2-reapply branch from 4880b9e to 6ea1201 Compare October 8, 2025 20:59
Comment on lines 1 to 2
module Tasks
class ProviderVerificationJob < ApplicationJob
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed this to FeProviderVerificationV2Job

Comment on lines 1 to 3
module AutomatedChecks
module ClaimVerifiers
class ProviderVerification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.
I've already updated this in my latest changes:

  • Class: AutomatedChecks::ClaimVerifiers::ProviderVerificationV2
  • Task name: fe_provider_verification_v2
  • Job: Tasks::FeProviderVerificationV2Job

# this has been completed.
if claim.eligibility.provider_verification_claimant_employment_check_declaration
Policies::FurtherEducationPayments.alternative_idv_completed!(claim)
elsif claim.academic_year != AcademicYear.new("2024/2025")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this guard is not needed? as it looks like you've already got a guard on #perform on the automated check. i think if we delegate the responsibility down each job/check can decide if it wants to process the claim or not, pushing things down the stack

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also no 2024/2025 claims will go through this wizard

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I'll remove the conditional and always call provider_verification_completed!

Comment on lines 74 to 75
verification: {
"verifier" => {
Copy link
Contributor

@asmega asmega Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verifier also applies to Y1 and has been superseded by provider_verification_verified_by_id for Y2 I believe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the spec

Comment on lines 117 to 134
verification: {
assertions: [
{name: "teaching_responsibilities", outcome: true},
{name: "teaching_start_year_matches_claim", outcome: true},
{name: "half_teaching_hours", outcome: true},
{name: "subjects_taught", outcome: true},
{name: "taught_at_least_one_term", outcome: true}
],
verifier: {
dfe_sign_in_uid: "123",
first_name: "Seymour",
last_name: "Skinner",
email: "seymore.skinner@springfield-elementary.edu",
dfe_sign_in_organisation_name: "Springfield Elementary",
dfe_sign_in_role_codes: ["teacher_payments_claim_verifier"]
},
created_at: Time.zone.now
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For year 2 claims we wont be writing anything to the further_education_payments_eligibilities.verification column. The year 1 journey that did write to this column has been removed. The column is only kept around for displaying last year's claims

Comment on lines 77 to 85
when "more_than_12"
"20_or_more_hours_per_week"
when "between_2_5_and_12"
"2_and_a_half_to_12_hours_per_week"
when "less_than_2_5"
"fewer_than_2_and_a_half_hours_per_week"
else
provider_hours
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like if the claimant choses more_than_20 then this task will always pass, even if the provider entered a different value (eg fewer_than_2_and_a_half_hours_per_week)?

end

def find_or_create_verifier_user
verifier_data = verification.fetch("verifier")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always throw when this task runs as verification will be {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 110 to 121
claimant_value = case eligibility.teaching_qualification
when "yes"
"Yes"
when "not_yet"
"Not yet, I am currently enrolled on one and working towards completing it"
when "no_but_planned"
"No, but I plan to enrol on one in the next 12 months"
when "no_not_planned"
"No, and I do not plan to enrol on one in the next 12 months"
else
"Not provided"
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably use the locales file for this
I18n.t(eligibility.teaching_qualification, scope: 'further_education_payments.forms.teaching_qualification.options')

"Timetabled teaching hours",
claimant_mapped = case eligibility.teaching_hours_per_week
when "more_than_12"
"20 hours or more each week"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "12 hours or more each week"?


VERIFIERS = [
AutomatedChecks::ClaimVerifiers::OneLoginIdentity,
AutomatedChecks::ClaimVerifiers::ProviderVerification, # Year 2+ only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want this verifier in the list that runs on initial claim submission, I think we only want it to run after the provider has submitted their part of the claim (which we're doing a few lines below with the provider_verification_completed! hook)

Comment on lines +31 to +33
within(".fe_provider_verification_v2") do
first("a").click
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we've changed this? Seems quite a bit less readable?

Comment on lines +23 to +27
claim.tasks.create!(
name: "fe_provider_verification_v2",
passed: false,
manual: true
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we need to create a task here?
If the provider hasn't completed verification then there won't be a task (unless an admin manually submits the task form, which we don't want to allow until the verification has been completed.)


def within_table_row(label, &block)
within(first("tr", text: label)) do
within(first("th", exact_text: label).find(:xpath, "./..")) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to change this but I'm just wondering why it needed to change if we've not changed any view files?

# this has been completed.
if claim.eligibility.provider_verification_claimant_employment_check_declaration
Policies::FurtherEducationPayments.alternative_idv_completed!(claim)
elsif claim.academic_year != AcademicYear.new("2024/2025")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still want the provider_verification_completed! hook to run even if the provider had to do ALT IDV before verifying the claim's eligibility.

@raul-gracia raul-gracia force-pushed the CAPT-2793-year2-reapply branch from 552bee0 to 3de2159 Compare October 16, 2025 08:36
@raul-gracia raul-gracia removed the deploy Deploy a review app for this PR label Oct 24, 2025
@raul-gracia raul-gracia force-pushed the CAPT-2793-year2-reapply branch 2 times, most recently from f50f551 to 2f29cec Compare October 24, 2025 13:30
Implements Year 2 (2025/2026+) enhancements for FE provider verification:

- Add new Year 2 specific fields to AdminTasksPresenter:
  * Teaching qualification with 4 options
  * Performance measures (renamed label)
  * Disciplinary action (renamed label)
  * Teaching hours with hour ranges
  * Conditional fields (hours next term, full academic year, taught one term)

- Create ProviderVerification auto-check verifier:
  * Auto-pass when all conditions met
  * Auto-fail when any condition fails
  * Skip Year 1 (2024/2025) claims
  * Uses teaching_start_year_matches_claim field
  * Maps teaching hours correctly (more_than_12 -> 20_or_more_hours_per_week)

- Add ProviderVerificationJob to trigger auto-check
- Add provider_verification_completed! hook for Year 2+ claims
- Add comprehensive test coverage for auto-pass/fail logic

Adapted to master architecture:
- Uses row-based AdminTasksPresenter approach (not separate presenter)
- Field: teaching_start_year_matches_claim (not in_first_five_years)
- Contract: no_direct_contract (not employed_by_another_organisation)
- Year-based routing already exists via admin_tasks_presenter method
- Update further_education_payments_spec to include ProviderVerification in VERIFIERS
- Update fe_provider_verification_v2_spec for Year 2 ordering and field displays
- Change task name from 'provider_verification' to 'fe_provider_verification_v2' for Year 2
- Update all provider verification specs to use correct task name
- Add academic_year specification to Year 2 tests
- Update field label expectations (performance/disciplinary renamed with "Subject to")
- Update hours display expectation (more_than_12 -> "20 hours or more each week")
- Add teaching qualification and contract covers full year to test expectations
Address PR review feedback:
- Rename ProviderVerificationJob to FeProviderVerificationV2Job for consistency
- Remove unnecessary FactoryBot.reload from spec
- Update verifier to check Year 2 eligibility columns instead of Year 1 assertions
- Fix specs to include required Year 2 provider verification columns

Changes:
- Job: ProviderVerificationJob → FeProviderVerificationV2Job
- Verifier: Check provider_verification_* columns directly instead of parsing assertions hash
- Specs: Add missing provider_verification_teaching_responsibilities,
  provider_verification_teaching_start_year_matches_claim, and
  provider_verification_half_teaching_hours to test data
- Remove Year 1 assertions array from Year 2 test data where not needed
  - Fix FeProviderVerificationV2Job spec to create FE claims
  - Add valid reason check for teaching qualification in ProviderVerificationV2
  - Fix I18n scope for teaching hours per week
  - Update AdminTasksPresenter spec to use flexible row matching
  - Update performance/disciplinary label expectations
@raul-gracia raul-gracia force-pushed the CAPT-2793-year2-reapply branch from 2f29cec to 75686d9 Compare October 24, 2025 14:25
@raul-gracia raul-gracia added the deploy Deploy a review app for this PR label Oct 24, 2025
@asmega
Copy link
Contributor

asmega commented Feb 27, 2026

No longer required, this is now a stale branch and requirements have been implemented elsewhere

@asmega asmega closed this Feb 27, 2026
@asmega asmega deleted the CAPT-2793-year2-reapply branch February 27, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy Deploy a review app for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants