-
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
Redistribute cases logic #12190
Redistribute cases logic #12190
Conversation
Code Climate has analyzed commit 631352b and detected 0 issues on this pull request. View more on Code Climate. |
Based on advice from Peter (https://dsva.slack.com/archives/CJL810329/p1573135068290400?thread_ts=1573133363.290200&cid=CJL810329), I examined all the ACD redistributed cases (those with
I interpret this as the appeal initially had no tasks (not even a RootTask!), it was fixed by Bat Team and distributed on Feb 26, and the RootTask was added on Mar 12. Here is an appeal with more tasks to examine:
This appeal had 4 tasks before it was fixed: RootTask, HearingTask, ScheduleHearingTask, and AssignHearingDispositionTask. I'm only examining tasks before the appeal was fixed since those are the only tasks that are available to the code when the problem is presented to Bat Team. The only date consistently set on DistributedCases is
There are only 29 of 114 appeals with tasks before the fix. Let's ignore RootTask and TrackVeteranTask because those were not considered relevant in this PR's code:
So there are 16 appeals with relevant tasks, from which to try to find a pattern. Let's look at the tasks for those 16 appeals:
Pattern 2: For appeals with some relevant tasks before the fix, all those tasks were closed. A task is considered Line 157 in 7dbad36
Note that a few elements have
Something to note that I'm not sure how to deal with:
The above has 5 relevant tasks before it was fixed. Both the Moving on ...
From the above, the only pattern is a "HearingTask" followed by a "ScheduleHearingTask", which isn't unique in itself. Triggering on that would result in a lot of false positives. At this point, I would conclude that checking for tasks that are not open (as the current PR code already does) is sufficient, pending further feedback on my interpretation of these results. |
I agree with "Pattern 1" Pattern 2 is trickier. Specifically, "cancelled" is significantly different than "completed". If all the tasks of a certain type (e.g. |
How does the following sound instead of Pattern 2? Could we generalize it to "if all Is there anything else I should examine? |
yes that sounds legit to start with. |
Generated by 🚫 Danger |
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.
logic looks right.
suggested some more idiomatic Ruby, otherwise lgtm.
I can't officially give an Approval on this PR since I created it, but I give my +1 to this and you can approve and merge it.
If deeper analysis is desired, try examining changes to the location code in VACOLS mentioned in https://dsva.slack.com/archives/C3EAF3Q15/p1573667863033800: vacols_ids[0..3].each_with_index do |id, i|
puts "vacols_id=#{id}"
pp VACOLS::Priorloc.where(lockey: id).order(:locdout).pluck(:locdout, :locstto, :locstrcv)
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.
|
||
# send to Sentry but do not raise exception. | ||
def alert_existing_distributed_case_not_unique | ||
error = CannotRedistribute.new("DistributedCase #{case_id} already exists") |
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.
Is it alright if I revert this error message to the previous "Distributed case already exists" without the case_id? The error no longer gets automatically grouped in Sentry because the error messages are now unique to the specific case.
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.
That was an attempt to make it easier to see in the Sentry log, but if the case_id is present in some other way, sure, fine to revert.
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, it's present in the Additional Data section, usually as vacols_id
connects #11713
Description
Sometimes it's appropriate to re-distribute a legacy case via automatic case distribution. In that circumstance, we must update the existing distributed_case
case_id
value to preserve the uniqueness constraint. This PR attempts to automate that re-distribution.