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

[Part 2] Populate aod_based_on_age column #14764

Conversation

yoomlam
Copy link
Contributor

@yoomlam yoomlam commented Jul 24, 2020

Resolves #14637

Part 1

Description

Only for AMA appeals -- AOD status of legacy appeals can be found in VACOLS.
Add and use Appeal.conditionally_set_aod_based_on_age method to set the new aod_based_on_age table column when loaded by the user.
Add a job to set aod_based_on_age nightly for claimants who meet the age criteria.

Acceptance Criteria

  • When aod_based_on_age is true, the appeal should show the AOD label/badge in the UI.
  • aod_based_on_age is true when appeal.claimant.advanced_on_docket_based_on_age? is true, after appeal.advanced_on_docket? is called.
  • After job is run, all active appeals associated with claimants age 75 and over will be marked as AOD (i.e., aod_based_on_age is true).

Testing Plan

  1. rails db:migrate
  2. In Rails console, check the value of aod_based_on_age before and after changing things that would affect (and not affect) aod_based_on_age (also check the UI for an AOD label):
> a=FactoryBot.create(:appeal, :with_schedule_hearing_tasks, :advanced_on_docket_due_to_age)
> a.uuid
=> "64881a96-49a5-4442-b7d4-41eea483eee0" # Use this to check the UI at http://localhost:3000/queue/appeals/64881a96-49a5-4442-b7d4-41eea483eee0
> a.aod_based_on_age
=> nil
> a.advanced_on_docket?
=> true
> a.aod_based_on_age
=> true

> a.claimant.person.update(date_of_birth: 74.years.ago)
=> true
> a.aod_based_on_age
=> true
> a.advanced_on_docket?
=> false
> a.aod_based_on_age
=> false

> a2=FactoryBot.create(:appeal, :with_schedule_hearing_tasks, :advanced_on_docket_due_to_age)
> a2.id
=> 708
> a2.uuid
=> "bccc4d86-ace1-41ce-99cf-cf013292b130"  # Use this to check the UI at http://localhost:3000/queue/appeals/bccc4d86-ace1-41ce-99cf-cf013292b130
> a2.aod_based_on_age
=> nil
> SetAppealAgeAodJob.new.perform_now
Performing SetAppealAgeAodJob (Job ID: fe8ff15c-6057-43f8-9b8c-594f4b4122d7) from Shoryuken(default)
SetAppealAgeAodJob completed after running for less than a minute.
IDs of age-related AOD appeals: [24, 708]
Performed SetAppealAgeAodJob (Job ID: fe8ff15c-6057-43f8-9b8c-594f4b4122d7) from Shoryuken(default) in 169.88ms
=> nil

Remember to rake db:rollback when done.

Code Documentation Updates

  • Add or update code comments at the top of the class, module, and/or component.

@yoomlam yoomlam self-assigned this Jul 24, 2020
@codeclimate
Copy link

codeclimate bot commented Jul 24, 2020

Code Climate has analyzed commit 26120303 and detected 0 issues on this pull request.

View more on Code Climate.

@yoomlam yoomlam changed the base branch from master to yoom/14637-part1-add-age-aod-column July 24, 2020 03:58
@yoomlam yoomlam added Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Type: Metrics or Reporting labels Jul 24, 2020
@yoomlam yoomlam changed the title WIP [Part 2] Populate age_aod column [Part 2] Populate age_aod column Jul 24, 2020
Copy link
Contributor

@hschallhorn hschallhorn left a comment

Choose a reason for hiding this comment

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

Some initial feedback before testing!

spec/jobs/set_appeal_age_aod_job_spec.rb Outdated Show resolved Hide resolved
app/models/claimant.rb Show resolved Hide resolved
app/models/appeal.rb Outdated Show resolved Hide resolved
app/jobs/set_appeal_age_aod_job.rb Outdated Show resolved Hide resolved
@yoomlam yoomlam force-pushed the yoom/14637-part2-populate-age-aod-column branch from b62cc20 to 3264d8d Compare July 27, 2020 16:07
app/models/claimant.rb Outdated Show resolved Hide resolved
expect(claimant.advanced_on_docket?(1.year.ago)).to eq(true)
expect(claimant.advanced_on_docket_motion_granted?(1.year.ago)).to eq(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a quick expect(claimant.advanced_on_docket_based_on_age?).to eq(false) check here?

Copy link
Contributor

@hschallhorn hschallhorn left a comment

Choose a reason for hiding this comment

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

Additional AC:

  • a.advanced_on_docket? doesn't make any database requests to other tables if the vet is aod based on age once age_aod is set! ⏩

Copy link
Contributor

@hschallhorn hschallhorn left a comment

Choose a reason for hiding this comment

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

Added some changes!

Copy link
Contributor

@hschallhorn hschallhorn left a comment

Choose a reason for hiding this comment

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

!! Glad we found a simpler way to implement this! Nice work!

@yoomlam yoomlam merged commit 71a3762 into yoom/14637-part1-add-age-aod-column Jul 28, 2020
@yoomlam yoomlam deleted the yoom/14637-part2-populate-age-aod-column branch July 28, 2020 20:45
@yoomlam yoomlam changed the title [Part 2] Populate age_aod column [Part 2] Populate aod_based_on_age column Jul 28, 2020
yoomlam added a commit that referenced this pull request Jul 28, 2020
* add aod_based_on_age column to appeals
* [Part 2] Populate age_aod column (#14764)
* add and use conditionally_set_aod_based_on_age
* add SetAppealAgeAodJob
* enable finer access to reasons for AOD
* exclude AttorneyClaimant from AOD logic
* improve test coverage
* handle case where aod_based_on_age changes to false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Type: Metrics or Reporting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants