-
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
Fix priority scope during case distribution #15376
Conversation
Code Climate has analyzed commit 1c61539 and detected 0 issues on this pull request. View more on Code Climate. |
join_appeal_specific_aod_motions | ||
.joins(claimants: :person) |
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 as simple as adding another OR
to the where
clause in priority
method above due to ArgumentError: Relation passed to #or must be structurally compatible error
-- solved with a tip from SO.
@@ -192,10 +192,8 @@ | |||
end | |||
|
|||
trait :inapplicable_aod_motion do | |||
established_at { Time.zone.tomorrow } |
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.
We no longer use established_at
to determine AOD applicability. Rely on the young claimant age and ungranted AOD motion below to make appeal ineligible for AOD.
.having("count(case when advance_on_docket_motions.granted and advance_on_docket_motions.created_at > appeals.established_at then 1 end) = ?", 0) | ||
.having("count(case when appeal_aod_motions.granted then 1 end) = ?", 0) # AOD motions associated with appeal |
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.
appeal_aod_motions
checks AOD motions associated directly with appeal (#14085).
Removed checking established_at
.
join_aod_motions.where(aod_based_on_age: true) | ||
.or(join_aod_motions.where("people.date_of_birth <= ?", 75.years.ago)) | ||
.or( # check AOD motions associated through the claimant | ||
join_aod_motions | ||
.where("advance_on_docket_motions.granted = ?", true) | ||
.where("advance_on_docket_motions.reason = ?", :age) | ||
) | ||
.or(join_aod_motions.where("appeal_aod_motions.granted = ?", true)) # AOD motions associated with appeal |
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.
Compare against ACs. Did not include CAVC remand check since it's not yet implemented.
let!(:aod_based_on_age_field_appeal) do | ||
create(:appeal, | ||
:with_post_intake_tasks, | ||
docket_type: Constants.AMA_DOCKETS.direct_review).tap { |a| a.update(aod_based_on_age: true) } | ||
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.
Claimant's age may not satisfy AOD requirements, but aod_based_on_age
is set on the appeal.
trait :advanced_on_docket_due_to_motion do | ||
# the appeal has to be established before the motion is created to apply to it. |
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.
established_at
is no longer relevant for AOD motions.
joins(Arel.sql(<<~JOIN_AOD_MOTION_ON_APPEAL_ID)) | ||
LEFT OUTER JOIN advance_on_docket_motions AS appeal_aod_motions | ||
ON appeal_aod_motions.appeal_id = appeals.id | ||
AND appeal_aod_motions.appeal_type = 'Appeal' | ||
JOIN_AOD_MOTION_ON_APPEAL_ID |
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.
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.
nice work, testing coverage looks 👍 lgtm 🚀
Waiting for Board confirmation. Merge this PR only if non-age-related AOD motions should be attached to specific appeals (due to #14085). |
Do not merge -- see #13175 (comment) |
ACD has been revisited several times since this PR was created, so this PR probably no longer has relevance. |
Resolves #15352
Description
Adjust
priority
scope used by distribution algorithm to use AOD motions attached to specific appeals (due to #14085).Acceptance Criteria
aod_based_on_age
is true on the appealaod_based_on_age
is true on the appealSetAppealAgeAodJob
and wheneverappeal.advanced_on_docket?
is calledSetAppealAgeAodJob
ranAppeal.aod_based_on_age
rather than the claimant.person's age #14785 (where we want to replace this with usingAppeal#aod_based_on_age
)Testing Plan
Ensure
spec/models/docket_spec.rb
covers all scenarios by using FactoryBot like in the new tests to create different type of appeals for manual testing.Also refer to testing plans on: