-
Notifications
You must be signed in to change notification settings - Fork 66
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
Update veteran status determination, VIC eligibility #1536
Changes from 4 commits
aedb764
c3049e0
588eaa6
662e05d
460a55e
7c74505
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/models/base' | ||
require 'common/models/redis_store' | ||
require 'mvi/messages/find_profile_message' | ||
|
@@ -12,6 +13,9 @@ class User < Common::RedisStore | |
|
||
UNALLOCATED_SSN_PREFIX = '796' # most test accounts use this | ||
|
||
# Defined per issue #6042 | ||
ID_CARD_ALLOWED_STATUSES = %w(V1 V3 V6).freeze | ||
|
||
redis_store REDIS_CONFIG['user_store']['namespace'] | ||
redis_ttl REDIS_CONFIG['user_store']['each_ttl'] | ||
redis_key :uuid | ||
|
@@ -111,8 +115,9 @@ def can_prefill_emis? | |
end | ||
|
||
def can_access_id_card? | ||
beta_enabled?(uuid, 'veteran_id_card') && loa3? && edipi.present? && veteran? | ||
rescue # Default to false for any veteran_status error | ||
beta_enabled?(uuid, 'veteran_id_card') && loa3? && edipi.present? && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Performance NITPICK, possibly do the loa3? check before beta_enabled? check to avoid making a db call if not necessary. Maybe even edipi since MVI is going to get fetched one way or the other if loa3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure why my comment got suppressed. Performance NITPICK: loa3? && edipi.present? && beta_enabled?(uuid, 'veteran_id_card') && will avoid invoking a database call unless necessary. LOA3 users will always fetch EDIPI one way or the other as part of users profile, and future hits will be a redis cache hit. Whereas for LOA1 you'd effectively be hitting the database first, every time. |
||
ID_CARD_ALLOWED_STATUSES.include?(veteran_status.title38_status) | ||
rescue StandardError # Default to false for any veteran_status error | ||
false | ||
end | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Not specifically aimed at this PR 😄 but the User model's getting pretty hefty. Once we have policy files for authorization all the
can_x?
logic can move there. Maybe moveID_CARD_ALLOWED_STATUSES
so all the constants are at the top of the class.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.
Agreed about the
can_xyz
methods getting crufty.Will move the constant.