Skip to content

Commit

Permalink
refactor - remove duplication with AdminProviderVerificationTaskPrese…
Browse files Browse the repository at this point in the history
…nter
  • Loading branch information
alkesh committed Sep 25, 2024
1 parent 44520be commit 3cf9d15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/models/claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,7 @@ def one_login_idv_mismatch?
def awaiting_provider_verification?
return false unless has_further_education_policy?

return false if eligibility.verified?

# TODO - duplication with app/models/policies/further_education_payments/admin_provider_verification_task_presenter.rb
!eligibility.flagged_as_duplicate? || notes.where(label: "provider_verification").any?
eligibility.awaiting_provider_verification?
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def admin_sent_emails
end

def verification_email_sent?
!claim.eligibility.flagged_as_duplicate? || verification_email_sent_by_admin_team?
claim.eligibility.awaiting_provider_verification?
end

def verification_email_sent_by_admin_team?
Expand Down
7 changes: 7 additions & 0 deletions app/models/policies/further_education_payments/eligibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def permanent_contract?
def verified?
verification.present?
end

def awaiting_provider_verification?
return false if verified?

# when a provider verification email is sent by the admin team, a note is created
!flagged_as_duplicate? || claim.notes.where(label: "provider_verification").any?
end
end
end
end

0 comments on commit 3cf9d15

Please sign in to comment.