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

[VI-1104] updates Form526 user_account lookup #21164

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
21 changes: 11 additions & 10 deletions app/models/form526_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ def submit_with_birls_id_that_hasnt_been_tried_yet!(

# Note that the User record is cached in Redis -- `User.redis_namespace_ttl`
def get_first_name
user = User.find(user_uuid)
user&.first_name&.upcase.presence ||
auth_headers&.dig('va_eauth_firstName')&.upcase
user&.first_name&.upcase.presence || auth_headers&.dig('va_eauth_firstName')&.upcase
end

# Checks against the User record first, and then resorts to checking the auth_headers
Expand All @@ -162,7 +160,7 @@ def get_first_name
# @return [Hash] of the user's full name (first, middle, last, suffix)
#
def full_name
name_hash = User.find(user_uuid)&.full_name_normalized
name_hash = user&.full_name_normalized
return name_hash if name_hash&.[](:first).present?

{
Expand Down Expand Up @@ -600,7 +598,6 @@ def submit_form_8940
end

def submit_flashes
user = User.find(user_uuid)
# Note that the User record is cached in Redis -- `User.redis_namespace_ttl`
# If this method runs after the TTL, then the flashes will not be applied -- a possible bug.
BGS::FlashUpdater.perform_async(id) if user && Flipper.enabled?(:disability_compensation_flashes, user)
Expand Down Expand Up @@ -634,11 +631,15 @@ def get_past_submissions
end

def get_user_verifications
UserVerification.where(idme_uuid: user_uuid)
.or(UserVerification.where(backing_idme_uuid: user_uuid))
.or(UserVerification.where(logingov_uuid: user_uuid))
.or(UserVerification.where(mhv_uuid: user_uuid))
.or(UserVerification.where(dslogon_uuid: user_uuid))
UserVerification.where(idme_uuid: user&.idme_uuid)
.or(UserVerification.where(backing_idme_uuid: user&.idme_uuid))
.or(UserVerification.where(logingov_uuid: user&.logingov_uuid))
.or(UserVerification.where(mhv_uuid: user&.mhv_credential_uuid))
.or(UserVerification.where(dslogon_uuid: user&.edipi))
.where.not(user_account_id:)
end

def user
@user ||= User.find(user_uuid)
end
end
Loading