-
Notifications
You must be signed in to change notification settings - Fork 19
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
Cache hearings related fields selectively #15577
Conversation
…ing task; avoid calls to vacols when caching poa names
Generated by 🚫 Danger |
Code Climate has analyzed commit d94a72d and detected 0 issues on this pull request. View more on Code Climate. |
# Replicates LegacyAppeal#current_hearing_request_type | ||
current_request = HearingDay::REQUEST_TYPES.key(changed_request)&.to_sym || original_request | ||
|
||
veteran_file_number = LegacyAppeal.veteran_file_number_from_bfcorlid(vacols_case.bfcorlid) |
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.
LegacyAppeal.veteran_file_number can make requests to VACOLS
so we can use the given vacols_case here to grab bfcorlid
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.
First pass of suggestions. Will continue to ponder improving the overall flow.
def appeal_ids_with_schedule_hearing_tasks | ||
@appeal_ids_with_schedule_hearing_tasks ||= [] | ||
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.
Wondering if you can pass this around as a local variable (and as an argument to methods) rather than storing this instance variable as the state of this service.
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.
yes i thought about that as well. i don't like having this as state of the service either but i was going back and forth because it requires passing this as parameter to multiple methods. I can definitely make those changes though
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.
If you don't mind converting it into a local variable, that will make the refactor easier.
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 also think there's a potential problem. Both cache_ama_appeals
(for AMA) and cache_legacy_appeal_postgres_data
/cache_legacy_appeal_vacols_data
(for Legacy) call append_appeals_with_open_schedule_hearing_tasks
, which only stores the appeal_id
without the appeal_type
. This means that AMA and Legacy appeal ids are clashing with each other. If cache_ama_appeals
is called first, there will be AMA appeal ids in appeal_ids_with_open_sched_hearing_task
when either of the Legacy methods are called, so there will be extra (AMA) appeal ids that are not relevant to Legacy appeals.
Should add a test for this to make sure that AMA appeal ids are not included in the cache update when the Legacy methods are called.
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 converted both appeal_ids_with_schedule_hearing_tasks
and vacols_id_to_appeal_id_mapping
into local variables so this should not be an issue anymore
Co-authored-by: Yoom Lam <[email protected]>
Co-authored-by: Yoom Lam <[email protected]>
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.
1 consideration but LTGM!
# vacols_id => appeal_id mapping | ||
def vacols_id_to_appeal_id_mapping(legacy_appeals) | ||
legacy_appeals.pluck(:vacols_id, :id).to_h | ||
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.
Consider deleting this method since it is only called once and is only 1 line of code.
This reverts commit 36f8bab.
May help with #15417
Resolves #15580
Description
ScheduleHearingTask
breakdown of appeals with open
ScheduleHearingTask
vs without (PROD)