Caseflow: Clean up PreRoutingFoiaColocatedTasks

Created on 27 Jan 2020  Β·  26Comments  Β·  Source: department-of-veterans-affairs/caseflow

PreRoutingColocatedTasks have been plaguing users since their inception after #11113. All other types have been completed or cancelled other than PreRoutingFoiaColocatedTasks.

AC

  • [ ] All PreRoutingFoiaColocatedTasks are cancelled

PrivacyActTask|Solution
---|---
None|Cancel PreRoutingFoiaColocatedTasks. Create FoiaColocatedTask assigned to the privacy team with previous task instructions. Ensure a FoiaTask was automatically created.
Active|Cancel PreRoutingFoiaColocatedTasks. Create FoiaColocatedTask assigned to the privacy team with previous task instructions. Ensure no FoiaTask is created. Move open PrivacyActTask org tree (with all descendants) under FoiaColocatedTask.
Complete|Mark PreRoutingFoiaColocatedTasks complete and cancel any other tasks. Ensure appeal location code is updated if there are no more open caseflow tasks

NOTES

Previous cleanup

pre_routing_tasks = PreRoutingColocatedTask.open.where(assigned_to_type: Organization.name)
pre_routing_tasks.count
=> 235
pp pre_routing_tasks.group(:type).count
{"PreRoutingMissingHearingTranscriptsColocatedTask"=>4,
 "PreRoutingTranslationColocatedTask"=>2,
 "PreRoutingFoiaColocatedTask"=>229}
# Let's start with the transcripts!

tasks =  pre_routing_tasks.where(type: PreRoutingMissingHearingTranscriptsColocatedTask.name)
tasks.count
=> 4
puts tasks.map { |task| task.appeal.structure_render(:status) }
LegacyAppeal 622800 [status]
β”œβ”€β”€ RootTask assigned
└── PreRoutingMissingHearingTranscriptsColocatedTask assigned
    └── PreRoutingMissingHearingTranscriptsColocatedTask completed
LegacyAppeal 82343 [status]
β”œβ”€β”€ RootTask completed
β”‚   β”œβ”€β”€ HearingTask cancelled
β”‚   β”‚   β”œβ”€β”€ ScheduleHearingTask completed
β”‚   β”‚   └── AssignHearingDispositionTask cancelled
β”‚   β”œβ”€β”€ HearingTask cancelled
β”‚   β”‚   └── AssignHearingDispositionTask cancelled
β”‚   └── HearingTask cancelled
β”‚       └── ScheduleHearingTask cancelled
β”‚           └── HearingAdminActionVerifyAddressTask cancelled
└── PreRoutingMissingHearingTranscriptsColocatedTask assigned
    └── PreRoutingMissingHearingTranscriptsColocatedTask completed
        β”œβ”€β”€ TimedHoldTask completed
        └── TimedHoldTask completed
LegacyAppeal 61216 [status]
β”œβ”€β”€ RootTask assigned
└── PreRoutingMissingHearingTranscriptsColocatedTask assigned
    └── PreRoutingMissingHearingTranscriptsColocatedTask completed
        β”œβ”€β”€ TimedHoldTask completed
        └── TimedHoldTask completed
LegacyAppeal 505144 [status]
β”œβ”€β”€ RootTask assigned
└── PreRoutingMissingHearingTranscriptsColocatedTask assigned
    └── PreRoutingMissingHearingTranscriptsColocatedTask completed
        β”œβ”€β”€ TimedHoldTask completed
        └── TimedHoldTask completed
# All of these have been completed. Closing
tasks.update_all(status: Constants.TASK_STATUSES.completed, closed_at: Time.zone.now)
# On to translation!

tasks =  pre_routing_tasks.where(type: PreRoutingTranslationColocatedTask.name)
puts tasks.map { |task| task.appeal.structure_render(:id, :status) }
Appeal 2649 [id, status]
└── RootTask 174463, on_hold
    β”œβ”€β”€ TrackVeteranTask 174464, in_progress
    β”œβ”€β”€ DistributionTask 174465, completed
    β”œβ”€β”€ TranslationTask 174466, on_hold
    β”‚   └── TranslationTask 194593, assigned
    β”‚       β”œβ”€β”€ TimedHoldTask 247905, completed
    β”‚       └── TimedHoldTask 363222, completed
    └── JudgeAssignTask 176926, on_hold
        └── AttorneyTask 176943, on_hold
            └── PreRoutingTranslationColocatedTask 184773, on_hold
                └── PreRoutingTranslationColocatedTask 184774, on_hold
                    └── TranslationTask 210658, on_hold
                        └── TranslationTask 213064, assigned
                            β”œβ”€β”€ TimedHoldTask 247867, completed
                            └── TimedHoldTask 363192, completed
Appeal 2280 [id, status]
└── RootTask 148720, on_hold
    β”œβ”€β”€ TrackVeteranTask 148721, cancelled
    β”œβ”€β”€ DistributionTask 148722, completed
    β”œβ”€β”€ TranslationTask 148723, completed
    β”‚   └── TranslationTask 268043, completed
    β”‚       └── TimedHoldTask 269586, cancelled
    β”œβ”€β”€ JudgeAssignTask 148738, on_hold
    β”‚   └── AttorneyTask 177210, on_hold
    β”‚       └── PreRoutingTranslationColocatedTask 190566, on_hold
    β”‚           └── PreRoutingTranslationColocatedTask 190567, on_hold
    β”‚               └── TranslationTask 210675, on_hold
    β”‚                   β”œβ”€β”€ TranslationTask 213145, cancelled
    β”‚                   β”‚   └── TimedHoldTask 258993, cancelled
    β”‚                   └── TranslationTask 265650, on_hold
    β”œβ”€β”€ TrackVeteranTask 165444, cancelled
    └── TrackVeteranTask 347466, in_progress
# These are still in progress, let’s update the translation task parent to the attorney task and cancel the colocated tasks 

task = tasks.first
atty_task = task.parent
atty_task.id
=> 176943
translation_task = task.descendants.detect { |task| task.type == TranslationTask.name && task.assigned_to_type == Organization.name }
translation_task.id
=> 210658
translation_task.update!(parent_id: atty_task.id)
puts task.appeal.structure_render(:id, :status)
Appeal 2649 [id, status]
└── RootTask 174463, on_hold
    β”œβ”€β”€ TrackVeteranTask 174464, in_progress
    β”œβ”€β”€ DistributionTask 174465, completed
    β”œβ”€β”€ TranslationTask 174466, on_hold
    β”‚   └── TranslationTask 194593, assigned
    β”‚       β”œβ”€β”€ TimedHoldTask 247905, completed
    β”‚       └── TimedHoldTask 363222, completed
    └── JudgeAssignTask 176926, on_hold
        └── AttorneyTask 176943, on_hold
            β”œβ”€β”€ PreRoutingTranslationColocatedTask 184773, on_hold
            β”‚   └── PreRoutingTranslationColocatedTask 184774, on_hold
            └── TranslationTask 210658, on_hold
                └── TranslationTask 213064, assigned
                    β”œβ”€β”€ TimedHoldTask 247867, completed
                    └── TimedHoldTask 363192, completed
task.reload.descendants.count
=> 2
task.descendants.each(&:cancelled!)


task = tasks.last
atty_task = task.parent
atty_task.id
=> 177210
translation_task = task.descendants.detect { |task| task.type == TranslationTask.name && task.assigned_to_type == Organization.name }
translation_task.id
=> 210675
translation_task.update!(parent_id: atty_task.id)
puts task.appeal.structure_render(:id, :status)
Appeal 2280 [id, status]
└── RootTask 148720, on_hold
    β”œβ”€β”€ TrackVeteranTask 148721, cancelled
    β”œβ”€β”€ DistributionTask 148722, completed
    β”œβ”€β”€ TranslationTask 148723, completed
    β”‚   └── TranslationTask 268043, completed
    β”‚       └── TimedHoldTask 269586, cancelled
    β”œβ”€β”€ JudgeAssignTask 148738, on_hold
    β”‚   └── AttorneyTask 177210, on_hold
    β”‚       β”œβ”€β”€ PreRoutingTranslationColocatedTask 190566, on_hold
    β”‚       β”‚   └── PreRoutingTranslationColocatedTask 190567, on_hold
    β”‚       └── TranslationTask 210675, on_hold
    β”‚           β”œβ”€β”€ TranslationTask 213145, cancelled
    β”‚           β”‚   └── TimedHoldTask 258993, cancelled
    β”‚           └── TranslationTask 265650, on_hold
    β”œβ”€β”€ TrackVeteranTask 165444, cancelled
    └── TrackVeteranTask 347466, in_progress
task.reload.descendants.count
=> 2
task.descendants.each(&:cancelled!)
# All that's left is FOIA!

tasks = PreRoutingColocatedTask.open.where(assigned_to_type: Organization.name)
tasks.count
=> 229
pp tasks.group(:type).count
{"PreRoutingFoiaColocatedTask"=>229}

What we're dealing with

# Here's what a correct foia colocated task tree looks like
puts FoiaColocatedTask.open.last.appeal.structure_render(:assigned_to_type, :assigned_to_id)
LegacyAppeal 14562 [assigned_to_type, assigned_to_id]
β”œβ”€β”€ RootTask Organization, 2
└── FoiaColocatedTask Organization, 202
    └── FoiaTask Organization, 202

puts tasks.last.appeal.structure_render(:status)
LegacyAppeal 42869 [status]
β”œβ”€β”€ RootTask assigned
└── PreRoutingFoiaColocatedTask on_hold
    └── PreRoutingFoiaColocatedTask on_hold
        └── PrivacyActTask on_hold
            └── PrivacyActTask assigned
# This is one of the nicer ones.

puts tasks.second.appeal.structure_render(:status)
LegacyAppeal 459664 [status]
β”œβ”€β”€ RootTask assigned
└── PreRoutingFoiaColocatedTask on_hold
    β”œβ”€β”€ PreRoutingFoiaColocatedTask cancelled
    β”‚   └── Task completed
    β”‚       └── Task completed
    β”‚           └── Task completed
    └── PreRoutingFoiaColocatedTask on_hold
        β”œβ”€β”€ Task on_hold
        β”‚   β”œβ”€β”€ Task cancelled
        β”‚   β”‚   └── TimedHoldTask cancelled
        β”‚   └── Task on_hold
        └── PrivacyActTask completed
            └── PrivacyActTask completed
# This is one of the, uh, more interesting ones
Medium caseflow-queue BVA Echo 🐬

All 26 comments

@hschallhorn The team would appreciate any context on this, but the ticket seems straightforward, so we went ahead and estimated it.

_What is this graph?_

1 | 
2 | |||||||
3 | |||
5 | 
8 |  

Potential lack of understanding from some team members, uncertainty around potential side effects.

No colocated tasks have been deprecated.

@hschallhorn For an active PrivacyActTask, creating a FoiaColocatedTask triggers creation of a child FoiaTask. Should I prevent triggering that child creation? If not, who should I assign it to?

~Great question! The workflow for active PrivacyActTask doesn't make sense as the closure of the PrivacyActTask will not trigger the closure of the FoiaColocatedTask. Let's, rather than create a FoiaColocatedTask, just change the PrivacyActTask's parent to the org PreRoutingFoiaColocatedTask's parent. I'll update the ticket.~ Attorney's on hold tab is populated by colocated tasks assigned by the attorney. If these privacy act tasks are not children of colocated tasks, they will not appear in the attorney's on hold tab

@hschallhorn If there are no PrivacyActTasks and the child tasks are completed, do we still want to "Create FoiaColocatedTask assigned to the privacy team with previous task instructions."?

LegacyAppeal 70285 (legacy)          ID     STATUS    UPDATED_AT
β”œβ”€β”€ RootTask                         35455  assigned  2019-02-12 17:18:22 UTC
└── PreRoutingFoiaColocatedTask      192219 assigned  2019-08-22 13:20:23 UTC
    └── PreRoutingFoiaColocatedTask  192220 completed 2019-08-22 13:20:23 UTC
        └── Task                     194927 completed 2019-11-21 20:18:22 UTC
            └── Task                 342979 completed 2019-11-21 20:18:30 UTC

Nope! Let's close those as well. Concerning that there are org foia colocated tasks open with a closed child user foia colocated task.

Concerning that I've said concerning so many times today.

On Feb 14, 2020 8:32 PM, Yoom Lam notifications@github.com wrote:
This message originated outside of the TISTA email domain. Confirm the sender's identity before replying, or clicking on links or attachments. Use the Report Message button to report spam or phishing emails

@hschallhorn [github.com]https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_hschallhorn&d=DwMCaQ&c=_2FTC-5tOVgbKgP09PZ5zQ&r=X7eJBZvVJlhB208cwIKU_cCf4ot77R4hTPRAyCu1yP8&m=jsHwcqlU3vXWCoDphGhwhD9RTzHqOUxwhzWpPnOT9tI&s=mr-WSbssCHsgWSP2YPPzCMts8S6aHPICVve4wLlC_E8&e= If there are no PrivacyActTasks and the child tasks are completed, do we still want to "Create FoiaColocatedTask assigned to the privacy team with previous task instructions."?

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub [github.com]https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_department-2Dof-2Dveterans-2Daffairs_caseflow_issues_13266-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAK3W2HUXS4Q3RJ76WSA6DGTRC5A4HA5CNFSM4KMDOL5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL26FKY-23issuecomment-2D586539691&d=DwMCaQ&c=_2FTC-5tOVgbKgP09PZ5zQ&r=X7eJBZvVJlhB208cwIKU_cCf4ot77R4hTPRAyCu1yP8&m=jsHwcqlU3vXWCoDphGhwhD9RTzHqOUxwhzWpPnOT9tI&s=n-5YIRwJlY4NHS5LqO5kbStu3-EddYwVrXB4zRJSoEs&e=, or unsubscribe [github.com]https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AK3W2HWEFWCBGXXUEAZHXILRC5A4HANCNFSM4KMDOL5A&d=DwMCaQ&c=_2FTC-5tOVgbKgP09PZ5zQ&r=X7eJBZvVJlhB208cwIKU_cCf4ot77R4hTPRAyCu1yP8&m=jsHwcqlU3vXWCoDphGhwhD9RTzHqOUxwhzWpPnOT9tI&s=z8TDYCb-TqaYCvNtCxh9pAOAOiW3m3Ukc6SM_HKqQ_g&e=.

The information transmitted by this email is intended only for the person or entity to which it is addressed. This email may contain proprietary, business-confidential and/or privileged material. If you are not the intended recipient of this message, be aware that any use, review, re-transmission, distribution, reproduction or any action taken in reliance upon this message is strictly prohibited. If you received this in error, please contact the sender and delete the material from all computers.

@hschallhorn For the complete PrivacyActTasks scenario, should an in_progress TrackVeteranTask be ignored when checking if there are opened tasks?

LegacyAppeal 254335 (legacy)              ID     STATUS      UPDATED_AT
β”œβ”€β”€ RootTask                              79538  on_hold     2019-02-21 17:04:04 UTC
β”‚   β”œβ”€β”€ HearingTask                       79539  completed   2019-04-28 05:01:03 UTC
β”‚   β”‚   β”œβ”€β”€ ScheduleHearingTask           79540  completed   2019-03-18 13:09:19 UTC
β”‚   β”‚   └── AssignHearingDispositionTask  144400 completed   2019-06-25 21:06:51 UTC
β”‚   └── TrackVeteranTask                  155259 in_progress 2019-07-05 19:19:03 UTC
└── PreRoutingFoiaColocatedTask           300609 assigned    2019-08-21 15:36:19 UTC
    └── PreRoutingFoiaColocatedTask       300610 completed   2019-08-21 15:36:17 UTC
        └── PrivacyActTask                301361 completed   2019-08-06 12:03:39 UTC
            └── PrivacyActTask            307715 completed   2019-08-06 12:03:39 UTC

Not sure what to do with these:

LegacyAppeal 367152 (legacy)         ID     STATUS      ASGN_BY      ASGN_TO      UPDATED_AT
β”œβ”€β”€ RootTask                         2822   assigned                 Bva          2018-12-07 19:40:13 UTC
β”œβ”€β”€ ExtensionColocatedTask           70918  completed   BVAEBRANDAU  Colocated    2019-07-19 14:50:05 UTC
β”‚   β”œβ”€β”€ ExtensionColocatedTask       70919  cancelled   BVAEBRANDAU  BVAPBROWNING 2019-07-19 14:50:05 UTC
β”‚   └── ExtensionColocatedTask       152320 cancelled   BVACBENJAMIN BVARSEAY     2019-07-19 14:50:02 UTC
└── PreRoutingFoiaColocatedTask      70920  on_hold     BVAEBRANDAU  Colocated    2020-02-15 03:17:54 UTC
    β”œβ”€β”€ PreRoutingFoiaColocatedTask  70921  cancelled   BVAEBRANDAU  BVAPBROWNING 2019-07-19 14:50:05 UTC
    └── PreRoutingFoiaColocatedTask  152321 in_progress BVACBENJAMIN BVATHUNTER   2019-07-19 14:50:21 UTC

LegacyAppeal 584318 (legacy)         ID     STATUS    ASGN_BY     ASGN_TO      UPDATED_AT
β”œβ”€β”€ RootTask                         112695 assigned              Bva          2019-02-26 20:19:50 UTC
β”œβ”€β”€ ExtensionColocatedTask           137734 completed VACOALHINM  Colocated    2019-07-19 14:50:25 UTC
β”‚   └── ExtensionColocatedTask       137735 completed VACOALHINM  BVAPBROWNING 2019-07-19 14:55:10 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      249461 completed VACOALHINM  Colocated    2019-07-19 14:49:46 UTC
β”‚   └── PreRoutingFoiaColocatedTask  249462 completed VACOALHINM  BVAMWALLACE  2019-07-19 14:55:22 UTC
β”‚       └── PrivacyActTask           250169 completed BVAMWALLACE PrivacyTeam  2019-08-08 19:06:59 UTC
└── PreRoutingFoiaColocatedTask      255331 on_hold   VACOALHINM  Colocated    2019-07-19 14:55:27 UTC
    └── PreRoutingFoiaColocatedTask  255332 on_hold   VACOALHINM  VACOWIGGIG   2020-01-08 19:41:47 UTC
        β”œβ”€β”€ PrivacyActTask           257635 completed VACOWIGGIG  PrivacyTeam  2019-08-08 19:08:10 UTC
        β”œβ”€β”€ PrivacyActTask           356339 completed VACOWIGGIG  PrivacyTeam  2019-08-28 14:40:51 UTC
        β”œβ”€β”€ PrivacyActTask           360622 cancelled VACOWIGGIG  PrivacyTeam  2019-08-29 20:13:14 UTC
        β”œβ”€β”€ PrivacyActTask           369537 cancelled VACOWIGGIG  PrivacyTeam  2019-09-24 20:06:40 UTC
        β”œβ”€β”€ PrivacyActTask           434610 completed VACOWIGGIG  PrivacyTeam  2019-10-25 17:53:05 UTC
        └── PrivacyActTask           608110 assigned  VACOBOOKEK  PrivacyTeam  2020-01-08 19:41:47 UTC

LegacyAppeal 201224 (legacy)         ID     STATUS   ASGN_BY      ASGN_TO           UPDATED_AT
β”œβ”€β”€ RootTask                         144930 assigned              Bva               2019-03-18 17:17:32 UTC
└── PreRoutingFoiaColocatedTask      150029 on_hold  BVATBERRYMAN Colocated         2019-07-19 14:50:06 UTC
    └── PreRoutingFoiaColocatedTask  150030 on_hold  BVATBERRYMAN BVATHUNTER        2019-07-19 14:50:06 UTC
        └── Task                     176395 on_hold  BVATHUNTER   PrivacyTeam       2019-11-21 20:18:21 UTC
            └── Task                 176652 assigned BVAJRETAN    TranscriptionTeam 2019-11-21 20:18:21 UTC

LegacyAppeal 459664 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO     UPDATED_AT
β”œβ”€β”€ RootTask                         10088  assigned               Bva         2018-12-19 18:58:15 UTC
└── PreRoutingFoiaColocatedTask      10092  on_hold   BVADTCHERRY  Colocated   2019-07-19 14:55:26 UTC
    β”œβ”€β”€ PreRoutingFoiaColocatedTask  10093  cancelled BVADTCHERRY  BVALCLANTON 2019-07-19 14:49:49 UTC
    β”‚   └── Task                     11839  completed BVALCLANTON  PrivacyTeam 2019-11-21 20:18:21 UTC
    β”‚       └── Task                 15401  completed BVAJRETAN    Colocated   2019-11-21 20:18:22 UTC
    β”‚           └── Task             15402  completed BVAJRETAN    BVAMWALLACE 2019-11-21 20:18:25 UTC
    └── PreRoutingFoiaColocatedTask  152161 on_hold   BVACBENJAMIN BVATHUNTER  2019-07-19 14:50:19 UTC
        β”œβ”€β”€ Task                     182584 on_hold   BVATHUNTER   PrivacyTeam 2019-11-21 20:18:29 UTC
        β”‚   β”œβ”€β”€ Task                 231749 cancelled VACOMCDONR2  VACOMCDONR2 2019-11-21 20:18:24 UTC
        β”‚   └── Task                 250519 assigned  VACOMCDONR2  BVAJRETAN   2020-02-14 23:45:36 UTC
        β”‚       └── TimedHoldTask    231766 cancelled VACOMCDONR2  VACOMCDONR2 2020-02-14 23:42:58 UTC
        └── PrivacyActTask           463742 completed BVATHUNTER   PrivacyTeam 2019-10-28 22:00:47 UTC
            └── PrivacyActTask       492554 completed BVAJRETAN    BVATPLOWDEN 2019-10-28 22:00:47 UTC

LegacyAppeal 553895 (legacy)         ID     STATUS    ASGN_BY    ASGN_TO     UPDATED_AT
β”œβ”€β”€ RootTask                         144179 assigned             Bva         2019-03-16 17:35:57 UTC
└── PreRoutingFoiaColocatedTask      298362 on_hold   BVADAMES   Colocated   2019-07-29 18:00:22 UTC
    └── PreRoutingFoiaColocatedTask  298363 on_hold   BVADAMES   VACODRAYTM  2019-07-30 14:11:05 UTC
        └── PrivacyActTask           299604 on_hold   VACODRAYTM PrivacyTeam 2019-08-20 15:19:27 UTC
            └── PrivacyActTask       340211 on_hold   BVAJRETAN  BVAJRETAN   2019-11-20 16:50:03 UTC
                β”œβ”€β”€ TimedHoldTask    419224 completed BVAJRETAN  BVAJRETAN   2019-11-18 03:30:22 UTC
                └── TimedHoldTask    531743 assigned  BVAJRETAN  BVAJRETAN   2019-11-20 16:50:03 UTC

should an in_progress TrackVeteranTask be ignored when checking if there are opened tasks?

Yes. We're only talking about open tasks on the PreRoutingFoiaColocatedTask specific trees.

πŸ‘€-ing the specific appeals in a sec

@hschallhorn For active PrivacyActTask scenario, should I move the open parent PrivacyActTask as well? The ticket description explicitly states active but I want to double-check.

                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
LegacyAppeal 394108 (legacy) ────── β”‚ ID     β”‚ STATUS   β”‚ ASGN_BY      β”‚ ASGN_TO      β”‚ UPDATED_AT              β”‚
β”œβ”€β”€ RootTask                        β”‚ 202777 β”‚ assigned β”‚              β”‚ Bva          β”‚ 2019-05-14 20:36:30 UTC β”‚
└── PreRoutingFoiaColocatedTask     β”‚ 213150 β”‚ on_hold  β”‚ VACOLEEC4    β”‚ Colocated    β”‚ 2019-07-19 14:55:07 UTC β”‚
    └── PreRoutingFoiaColocatedTask β”‚ 213151 β”‚ on_hold  β”‚ VACOLEEC4    β”‚ BVAPBROWNING β”‚ 2019-09-04 20:36:16 UTC β”‚
        └── PrivacyActTask          β”‚ 375555 β”‚ on_hold  β”‚ BVAPBROWNING β”‚ PrivacyTeam  β”‚ 2020-01-16 20:56:41 UTC β”‚
            └── PrivacyActTask      β”‚ 625607 β”‚ assigned β”‚ BVAJRETAN    β”‚ BVAAMILHOUSE β”‚ 2020-01-16 20:56:41 UTC β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

After moving only the active PrivacyActTask:

                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
LegacyAppeal 394108 (legacy) ────── β”‚ ID     β”‚ STATUS    β”‚ ASGN_BY      β”‚ ASGN_TO      β”‚ UPDATED_AT              β”‚
β”œβ”€β”€ RootTask                        β”‚ 202777 β”‚ on_hold   β”‚              β”‚ Bva          β”‚ 2020-02-18 15:35:44 UTC β”‚
β”‚   └── FoiaColocatedTask           β”‚ 694650 β”‚ assigned  β”‚ VACOLEEC4    β”‚ PrivacyTeam  β”‚ 2020-02-18 15:35:44 UTC β”‚
β”‚       └── PrivacyActTask          β”‚ 625607 β”‚ assigned  β”‚ BVAJRETAN    β”‚ BVAAMILHOUSE β”‚ 2020-02-18 15:35:45 UTC β”‚
└── PreRoutingFoiaColocatedTask     β”‚ 213150 β”‚ cancelled β”‚ VACOLEEC4    β”‚ Colocated    β”‚ 2020-02-18 15:35:45 UTC β”‚
    └── PreRoutingFoiaColocatedTask β”‚ 213151 β”‚ cancelled β”‚ VACOLEEC4    β”‚ BVAPBROWNING β”‚ 2020-02-18 15:35:46 UTC β”‚
        └── PrivacyActTask          β”‚ 375555 β”‚ on_hold   β”‚ BVAPBROWNING β”‚ PrivacyTeam  β”‚ 2020-01-16 20:56:41 UTC β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Should I cancel task 375555?

We want to move the whole PrivacyActTask tree. So the PrivacyActTask org task, child user task, and any timed hold tasks. We'd just change the parent id of the org PrivacyActTask, which shifts the whole tree over to the FoiaColocatedTask

Corrected:

                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
LegacyAppeal 394108 (legacy) ────── β”‚ ID     β”‚ STATUS    β”‚ ASGN_BY      β”‚ ASGN_TO      β”‚ UPDATED_AT              β”‚
β”œβ”€β”€ RootTask                        β”‚ 202777 β”‚ on_hold   β”‚              β”‚ Bva          β”‚ 2020-02-18 15:35:44 UTC β”‚
β”‚   └── FoiaColocatedTask           β”‚ 694650 β”‚ assigned  β”‚ VACOLEEC4    β”‚ PrivacyTeam  β”‚ 2020-02-18 15:35:44 UTC β”‚
β”‚       └── PrivacyActTask          β”‚ 375555 β”‚ on_hold   β”‚ BVAPBROWNING β”‚ PrivacyTeam  β”‚ 2020-02-18 15:46:33 UTC β”‚
β”‚           └── PrivacyActTask      β”‚ 625607 β”‚ assigned  β”‚ BVAJRETAN    β”‚ BVAAMILHOUSE β”‚ 2020-02-18 15:45:37 UTC β”‚
└── PreRoutingFoiaColocatedTask     β”‚ 213150 β”‚ cancelled β”‚ VACOLEEC4    β”‚ Colocated    β”‚ 2020-02-18 15:35:45 UTC β”‚
    └── PreRoutingFoiaColocatedTask β”‚ 213151 β”‚ cancelled β”‚ VACOLEEC4    β”‚ BVAPBROWNING β”‚ 2020-02-18 15:35:46 UTC β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

367152 - No work has been started on a privacy act task - 1st scenario - Cancel PreRoutingFoiaColocatedTasks. Create FoiaColocatedTask assigned to the privacy team with previous task instructions. Ensure a FoiaTask was automatically created.

584318 - Active PrivacyActTask (assuming all these were intentionally created, and privacy work needs to be done on this case still) - 2nd Scenario - Cancel PreRoutingFoiaColocatedTasks. Create FoiaColocatedTask assigned to the privacy team with previous task instructions. Ensure no FoiaTask is created. Move open PrivacyActTask org tree (with all descendants) under FoiaColocatedTask.

201224 - Wow, let's get back to this in a sec

459664 - Privacy work has been completed - 3rd scenario - Mark PreRoutingFoiaColocatedTasks complete and cancel any other tasks. Ensure appeal location code is updated if there are no more open caseflow tasks.

553895 - Active PrivacyActTask - 2rd scenario - Cancel PreRoutingFoiaColocatedTasks. Create FoiaColocatedTask assigned to the privacy team with previous task instructions. Ensure no FoiaTask is created. Move open PrivacyActTask org tree (with all descendants) under FoiaColocatedTask.

201224 - Based on the instructions of the tasks, this should indeed be with the transcription team. Scenario 2 - Cancel PreRoutingFoiaColocatedTasks. Create FoiaColocatedTask assigned to the privacy team with previous task instructions. Ensure no FoiaTask is created. Move open PrivacyActTask org tree (with all descendants) under FoiaColocatedTask.

We could also update the type of 176395 to "PrivacyActTask" and 176652 to "TranscriptionTask" or leave that to be done in #13268

@yoomlam , we shouldn't be moving these under the root task. We should still keep the same branch structure of other colocated tasks on legacy appeals where the colocated org task has no parent

LegacyAppeal 394108 (legacy) ────── β”‚ ID     β”‚ STATUS    β”‚ ASGN_BY      β”‚ ASGN_TO      β”‚ UPDATED_AT              β”‚
β”œβ”€β”€ RootTask                        β”‚ 202777 β”‚ on_hold   β”‚              β”‚ Bva          β”‚ 2020-02-18 15:35:44 UTC β”‚
β”œβ”€β”€ FoiaColocatedTask               β”‚ 694650 β”‚ assigned  β”‚ VACOLEEC4    β”‚ PrivacyTeam  β”‚ 2020-02-18 15:35:44 UTC β”‚
β”‚   └── PrivacyActTask              β”‚ 375555 β”‚ on_hold   β”‚ BVAPBROWNING β”‚ PrivacyTeam  β”‚ 2020-02-18 15:46:33 UTC β”‚
β”‚       └── PrivacyActTask          β”‚ 625607 β”‚ assigned  β”‚ BVAJRETAN    β”‚ BVAAMILHOUSE β”‚ 2020-02-18 15:45:37 UTC β”‚
└── PreRoutingFoiaColocatedTask     β”‚ 213150 β”‚ cancelled β”‚ VACOLEEC4    β”‚ Colocated    β”‚ 2020-02-18 15:35:45 UTC β”‚
    └── PreRoutingFoiaColocatedTask β”‚ 213151 β”‚ cancelled β”‚ VACOLEEC4    β”‚ BVAPBROWNING β”‚ 2020-02-18 15:35:46 UTC β”‚

Noting the appeals I'm changing:

pre_routing_tasks = PreRoutingColocatedTask.open.where(assigned_to_type: Organization.name)
pre_routing_tasks.count
=> 193

# remaining to clean up
pp pre_routing_tasks.group(:type).count
=> {"PreRoutingFoiaColocatedTask"=>193}

# count appeals
prfAppIds=PreRoutingFoiaColocatedTask.open.pluck(:appeal_id).uniq;
=> [510211, 32740, 498649, 552610, 70285, 525836, 225570, 781153, 794299, 769949, 275870, 515452, 386989, 305164, 580615, 861102, 442244, 874977, 53349, 254335, 196934, 330461, 782099, 394108, 194768, 473501, 358121, 299944, 67720, 392140, 584318, 116362, 827599, 788044, 669093, 811566, 797195, 874986, 264461, 302412, 553278, 277520, 827455, 553895, 339245, 564906, 499405, 569457, 442403, 514003, 362375, 40800, 458885, 202620, 135660, 344833, 323161, 106161, 352568, 500002, 32858, 469514, 447729, 458511, 448875, 850300, 424718, 478494, 796864, 42869, 288, 276050, 388713, 488971, 763937, 681477, 847396, 481939, 778921, 54896, 859327, 733727, 421415, 131321, 314858, 817334, 257174, 50020, 371362, 719168, 76779, 391108, 603004, 175523, 221219, 283596, 453675, 367152, 201224, 86727, 437156, 433732, 21436, 795591, 249986, 492965, 158974, 276261, 343599, 385528, 159214, 652546, 637667, 399413, 436080, 591666, 450156, 103207, 157726, 564865, 146504, 640573, 138276, 491146, 63560, 372398, 123419, 295144, 14178, 103450, 381133, 229530, 678280, 209060, 639276, 307333, 356992, 168739, 456076, 336381, 82507, 557625, 306487, 12876, 459664, 454263, 470153, 49757, 4359, 790955, 339996, 712334, 398611, 326747, 580019, 447423, 253479, 792843, 322454, 436868, 727041, 275970, 646014, 480780, 492801, 451725, 680551, 82724, 335453, 489907, 217262, 842973, 344514, 86611, 627106, 687229, 730102, 319184, 609888, 169069, 347912, 497298, 767821, 488978, 508866, 517772, 508865, 458881, 248425, 294731, 124301, 123868, 466100]
prfAppIds.count
=> 193

# so no repeats. Good!

appeals=PreRoutingFoiaColocatedTask.open.where(assigned_to_type: Organization.name).map(&:appeal);

## Appeals with complete PrivacyActTask
appeals_complete_pat=appeals.select { |a|
  pre_tasks=a.tasks.where(type: :PreRoutingFoiaColocatedTask).where(assigned_to_type: Organization.name)
  if pre_tasks.count!=1  # 584318 ????
    puts "Should not happen! #{a.id}  task #{pre_tasks.first.id}"
    next
  end
  any_priv_tasks = a.tasks.where(type: :PrivacyActTask)
  priv_actives=any_priv_tasks.active
  any_priv_tasks.size != 0 && priv_actives.size == 0
}
appeals_complete_pat.size
=> 33

## Appeals with no PrivacyActTask
appeals_no_pat=appeals.select { |a|
  pre_tasks=a.tasks.where(type: :PreRoutingFoiaColocatedTask).where(assigned_to_type: Organization.name)
  if pre_tasks.count!=1  # 584318 ????
    puts "Should not happen! #{a.id}  task #{pre_tasks.first.id}"
    next
  end
  any_priv_tasks = a.tasks.where(type: :PrivacyActTask)
  any_priv_tasks.size == 0
}

appeals_no_pat.size
=>2
=> [367152, 201224]
# I manually fixed these

## Appeals with active PrivacyActTask
appeals_active_pat=appeals.select { |a|
  pre_tasks=a.tasks.where(type: :PreRoutingFoiaColocatedTask).where(assigned_to_type: Organization.name)
  if pre_tasks.count!=1
    puts "Should not happen! #{a.id}  task #{pre_tasks.first.id}"
    next
  end
  any_priv_tasks = a.tasks.where(type: :PrivacyActTask)
  priv_opens=any_priv_tasks.open
  any_priv_tasks.size != 0 && priv_opens.size > 0
}
appeals_active_pat.size
=> 141

33 + 2 + 141
=> 176
# I'll manually fix the remaining (193-176)

Cleaned up per your instructions with some commentary.

LegacyAppeal 367152 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO      UPDATED_AT
β”œβ”€β”€ RootTask                         2822   on_hold                Bva          2020-02-18 16:00:20 UTC
β”œβ”€β”€ ExtensionColocatedTask           70918  completed BVAEBRANDAU  Colocated    2019-07-19 14:50:05 UTC
β”‚   β”œβ”€β”€ ExtensionColocatedTask       70919  cancelled BVAEBRANDAU  BVAPBROWNING 2019-07-19 14:50:05 UTC
β”‚   └── ExtensionColocatedTask       152320 cancelled BVACBENJAMIN BVARSEAY     2019-07-19 14:50:02 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      70920  cancelled BVAEBRANDAU  Colocated    2020-02-18 15:57:46 UTC
β”‚   β”œβ”€β”€ PreRoutingFoiaColocatedTask  70921  cancelled BVAEBRANDAU  BVAPBROWNING 2019-07-19 14:50:05 UTC
β”‚   └── PreRoutingFoiaColocatedTask  152321 cancelled BVACBENJAMIN BVATHUNTER   2020-02-18 16:01:51 UTC
└── FoiaColocatedTask                694766 assigned  BVAEBRANDAU  PrivacyTeam  2020-02-18 16:13:22 UTC
# FOIA-related tasks are no longer assigned to specific people.

LegacyAppeal 584318 (legacy)         ID     STATUS    ASGN_BY     ASGN_TO      UPDATED_AT
β”œβ”€β”€ RootTask                         112695 on_hold               Bva          2020-02-18 17:11:12 UTC
β”œβ”€β”€ ExtensionColocatedTask           137734 completed VACOALHINM  Colocated    2019-07-19 14:50:25 UTC
β”‚   └── ExtensionColocatedTask       137735 completed VACOALHINM  BVAPBROWNING 2019-07-19 14:55:10 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      249461 completed VACOALHINM  Colocated    2019-07-19 14:49:46 UTC
β”‚   └── PreRoutingFoiaColocatedTask  249462 completed VACOALHINM  BVAMWALLACE  2019-07-19 14:55:22 UTC
β”‚       └── PrivacyActTask           250169 completed BVAMWALLACE PrivacyTeam  2019-08-08 19:06:59 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      255331 cancelled VACOALHINM  Colocated    2020-02-18 17:24:55 UTC
β”‚   └── PreRoutingFoiaColocatedTask  255332 cancelled VACOALHINM  VACOWIGGIG   2020-02-18 17:24:58 UTC
β”‚       β”œβ”€β”€ PrivacyActTask           257635 completed VACOWIGGIG  PrivacyTeam  2019-08-08 19:08:10 UTC
β”‚       β”œβ”€β”€ PrivacyActTask           356339 completed VACOWIGGIG  PrivacyTeam  2019-08-28 14:40:51 UTC
β”‚       β”œβ”€β”€ PrivacyActTask           360622 cancelled VACOWIGGIG  PrivacyTeam  2019-08-29 20:13:14 UTC
β”‚       β”œβ”€β”€ PrivacyActTask           369537 cancelled VACOWIGGIG  PrivacyTeam  2019-09-24 20:06:40 UTC
β”‚       └── PrivacyActTask           434610 completed VACOWIGGIG  PrivacyTeam  2019-10-25 17:53:05 UTC
└── FoiaColocatedTask                695246 assigned  VACOALHINM  PrivacyTeam  2020-02-18 17:08:26 UTC
    └── PrivacyActTask               608110 assigned  VACOBOOKEK  PrivacyTeam  2020-02-18 17:22:42 UTC

LegacyAppeal 459664 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO     UPDATED_AT
β”œβ”€β”€ RootTask                         10088  assigned               Bva         2018-12-19 18:58:15 UTC
└── PreRoutingFoiaColocatedTask      10092  completed BVADTCHERRY  Colocated   2020-02-18 16:33:04 UTC
    β”œβ”€β”€ PreRoutingFoiaColocatedTask  10093  cancelled BVADTCHERRY  BVALCLANTON 2019-07-19 14:49:49 UTC
    β”‚   └── Task                     11839  completed BVALCLANTON  PrivacyTeam 2019-11-21 20:18:21 UTC
    β”‚       └── Task                 15401  completed BVAJRETAN    Colocated   2019-11-21 20:18:22 UTC
    β”‚           └── Task             15402  completed BVAJRETAN    BVAMWALLACE 2019-11-21 20:18:25 UTC
    └── PreRoutingFoiaColocatedTask  152161 completed BVACBENJAMIN BVATHUNTER  2020-02-18 16:34:21 UTC
        β”œβ”€β”€ Task                     182584 completed BVATHUNTER   PrivacyTeam 2020-02-18 11:52:43 UTC
        β”‚   β”œβ”€β”€ Task                 231749 cancelled VACOMCDONR2  VACOMCDONR2 2019-11-21 20:18:24 UTC
        β”‚   └── Task                 250519 completed VACOMCDONR2  BVAJRETAN   2020-02-18 11:52:43 UTC
        β”‚       └── TimedHoldTask    231766 cancelled VACOMCDONR2  VACOMCDONR2 2020-02-14 23:42:58 UTC
        └── PrivacyActTask           463742 completed BVATHUNTER   PrivacyTeam 2019-10-28 22:00:47 UTC
            └── PrivacyActTask       492554 completed BVAJRETAN    BVATPLOWDEN 2019-10-28 22:00:47 UTC
# location code set to "DTCHERRY"

LegacyAppeal 553895 (legacy)         ID     STATUS    ASGN_BY    ASGN_TO     UPDATED_AT
β”œβ”€β”€ RootTask                         144179 assigned             Bva         2019-03-16 17:35:57 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      298362 cancelled BVADAMES   Colocated   2020-02-18 17:30:49 UTC
β”‚   └── PreRoutingFoiaColocatedTask  298363 cancelled BVADAMES   VACODRAYTM  2020-02-18 17:30:49 UTC
└── FoiaColocatedTask                695318 on_hold   BVADAMES   PrivacyTeam 2020-02-18 17:29:07 UTC
    └── PrivacyActTask               299604 on_hold   VACODRAYTM PrivacyTeam 2020-02-18 17:30:48 UTC
        └── PrivacyActTask           340211 assigned  BVAJRETAN  BVAJRETAN   2020-02-18 17:30:18 UTC
            β”œβ”€β”€ TimedHoldTask        419224 completed BVAJRETAN  BVAJRETAN   2019-11-18 03:30:22 UTC
            └── TimedHoldTask        531743 completed BVAJRETAN  BVAJRETAN   2020-02-18 17:30:18 UTC

LegacyAppeal 201224 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO           UPDATED_AT
β”œβ”€β”€ RootTask                         144930 assigned               Bva               2019-03-18 17:17:32 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      150029 cancelled BVATBERRYMAN Colocated         2020-02-18 17:36:24 UTC
β”‚   └── PreRoutingFoiaColocatedTask  150030 cancelled BVATBERRYMAN BVATHUNTER        2020-02-18 17:36:24 UTC
└── FoiaColocatedTask                695345 assigned  BVATBERRYMAN PrivacyTeam       2020-02-18 17:35:19 UTC
    └── Task                         176395 on_hold   BVATHUNTER   PrivacyTeam       2020-02-18 17:36:14 UTC
        └── Task                     176652 assigned  BVAJRETAN    TranscriptionTeam 2019-11-21 20:18:21 UTC
# To be done in #13268: update the type of 176395 to "PrivacyActTask" and 176652 to "TranscriptionTask"

for 367152, a FoiaTask should have automatically been created. Looks like there is no FoiaTask on the appeal

for 367152, a FoiaTask should have automatically been created. Looks like there is no FoiaTask on the appeal

Oops! Fixed:

LegacyAppeal 367152 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO      UPDATED_AT
β”œβ”€β”€ RootTask                         2822   on_hold                Bva          2020-02-18 16:00:20 UTC
β”œβ”€β”€ ExtensionColocatedTask           70918  completed BVAEBRANDAU  Colocated    2019-07-19 14:50:05 UTC
β”‚   β”œβ”€β”€ ExtensionColocatedTask       70919  cancelled BVAEBRANDAU  BVAPBROWNING 2019-07-19 14:50:05 UTC
β”‚   └── ExtensionColocatedTask       152320 cancelled BVACBENJAMIN BVARSEAY     2019-07-19 14:50:02 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      70920  cancelled BVAEBRANDAU  Colocated    2020-02-18 15:57:46 UTC
β”‚   β”œβ”€β”€ PreRoutingFoiaColocatedTask  70921  cancelled BVAEBRANDAU  BVAPBROWNING 2019-07-19 14:50:05 UTC
β”‚   └── PreRoutingFoiaColocatedTask  152321 cancelled BVACBENJAMIN BVATHUNTER   2020-02-18 16:01:51 UTC
└── FoiaColocatedTask                694766 on_hold   BVAEBRANDAU  PrivacyTeam  2020-02-18 19:42:42 UTC
    └── FoiaTask                     695997 assigned  BVAEBRANDAU  PrivacyTeam  2020-02-18 19:42:42 UTC

This one has 2 PrivacyActTasks:

Before:

LegacyAppeal 517772 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO     UPDATED_AT
β”œβ”€β”€ RootTask                         281076 assigned               Bva         2019-07-18 17:38:02 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      305038 on_hold   BVAEDEICHERT Colocated   2019-08-01 21:46:32 UTC
β”‚   └── PreRoutingFoiaColocatedTask  305039 on_hold   BVAEDEICHERT VACOWIGGIG  2020-02-04 13:38:54 UTC
β”‚       β”œβ”€β”€ PrivacyActTask           369654 completed VACOWIGGIG   PrivacyTeam 2020-01-23 13:37:20 UTC
β”‚       β”‚   └── PrivacyActTask       624140 completed BVAJRETAN    VACODOUGLN  2020-01-23 13:37:20 UTC
β”‚       β”‚       └── TimedHoldTask    631549 cancelled VACODOUGLN   VACODOUGLN  2020-01-23 13:37:20 UTC
β”‚       └── PrivacyActTask           663280 assigned  VACOBOOKEK   PrivacyTeam 2020-02-04 13:38:53 UTC
└── ExtensionColocatedTask           305040 on_hold   BVAEDEICHERT Colocated   2019-08-01 21:46:34 UTC
    β”œβ”€β”€ ExtensionColocatedTask       305041 cancelled BVAEDEICHERT VACOWIGGIG  2020-02-04 13:40:02 UTC
    β”‚   └── TimedHoldTask            369650 completed VACOWIGGIG   VACOWIGGIG  2019-12-02 18:30:16 UTC
    └── ExtensionColocatedTask       663284 on_hold   VACOBOOKEK   BVALLEWIS   2020-02-04 19:29:28 UTC
        └── PrivacyActTask           665177 assigned  BVALLEWIS    PrivacyTeam 2020-02-04 19:29:28 UTC

After:

LegacyAppeal 517772 (legacy)         ID     STATUS    ASGN_BY      ASGN_TO     UPDATED_AT
β”œβ”€β”€ RootTask                         281076 assigned               Bva         2019-07-18 17:38:02 UTC
β”œβ”€β”€ PreRoutingFoiaColocatedTask      305038 cancelled BVAEDEICHERT Colocated   2020-02-18 20:18:03 UTC
β”‚   └── PreRoutingFoiaColocatedTask  305039 cancelled BVAEDEICHERT VACOWIGGIG  2020-02-18 20:18:03 UTC
β”‚       └── PrivacyActTask           369654 completed VACOWIGGIG   PrivacyTeam 2020-01-23 13:37:20 UTC
β”‚           └── PrivacyActTask       624140 completed BVAJRETAN    VACODOUGLN  2020-01-23 13:37:20 UTC
β”‚               └── TimedHoldTask    631549 cancelled VACODOUGLN   VACODOUGLN  2020-01-23 13:37:20 UTC
β”œβ”€β”€ ExtensionColocatedTask           305040 on_hold   BVAEDEICHERT Colocated   2019-08-01 21:46:34 UTC
β”‚   β”œβ”€β”€ ExtensionColocatedTask       305041 cancelled BVAEDEICHERT VACOWIGGIG  2020-02-04 13:40:02 UTC
β”‚   β”‚   └── TimedHoldTask            369650 completed VACOWIGGIG   VACOWIGGIG  2019-12-02 18:30:16 UTC
β”‚   └── ExtensionColocatedTask       663284 on_hold   VACOBOOKEK   BVALLEWIS   2020-02-04 19:29:28 UTC
β”‚       └── PrivacyActTask           665177 assigned  BVALLEWIS    PrivacyTeam 2020-02-04 19:29:28 UTC
└── FoiaColocatedTask                696368 assigned  BVAEDEICHERT PrivacyTeam 2020-02-18 20:17:31 UTC
    └── PrivacyActTask               663280 assigned  VACOBOOKEK   PrivacyTeam 2020-02-18 20:17:53 UTC

Remaining to be cleaned up:

appeals=PreRoutingFoiaColocatedTask.open.where(assigned_to_type: Organization.name).map(&:appeal);
=> 9
appeals.pluck :id
=> [782099, 264461, 82507, 103450, 82724, 433732, 276261, 257174, 458511]

Manually cleaned them.

Concluding stats to double-check:

started_time = Time.zone.now - 5.days
=> Thu, 13 Feb 2020 23:32:55 UTC +00:00

# Appeals where PreRoutingFoiaColocatedTask was marked cancelled
appeals_cancelled=PreRoutingFoiaColocatedTask.cancelled.where(assigned_to_type: Organization.name).where(updated_at: started_time..Time.zone.now ).map(&:appeal);
appeals_cancelled.count
=> 151

# Appeals where PreRoutingFoiaColocatedTask was marked completed
appeals_completed=PreRoutingFoiaColocatedTask.completed.where(assigned_to_type: Organization.name).where(updated_at: started_time..Time.zone.now ).map(&:appeal);
appeals_completed.count
=> 42

151 + 42
=> 193

Yay! Let' triple-check:

appealsCleaned = []
appealsCleaned = appealsCleaned + appeals_cancelled.pluck(:id)
=> [794299, 515452, 299944, 861102, 392140, 669093, 514003, 323161, 131321, 314858, 817334, 552610, 50020, 473501, 371362, 447729, 719168, 76779, 525836, 391108, 603004, 175523, 221219, 275870, 453675, 367152, 201224, 580615, 86727, 437156, 21436, 795591, 343599, 436080, 450156, 146504, 640573, 138276, 63560, 372398, 123419, 295144, 381133, 229530, 678280, 209060, 639276, 307333, 356992, 448875, 557625, 82507, 454263, 339996, 712334, 796864, 398611, 580019, 447423, 322454, 344833, 225570, 14178, 275970, 103450, 553895, 680551, 335453, 489907, 82724, 217262, 86611, 319184, 169069, 491146, 458511, 508866, 517772, 42869, 508865, 510211, 305164, 781153, 769949, 196934, 330461, 394108, 584318, 194768, 358121, 827599, 788044, 553278, 827455, 564906, 499405, 362375, 40800, 458885, 202620, 135660, 106161, 352568, 339245, 500002, 32858, 478494, 302412, 249986, 492965, 158974, 385528, 159214, 652546, 637667, 399413, 591666, 157726, 564865, 421415, 424718, 168739, 456076, 336381, 306487, 12876, 470153, 253479, 49757, 4359, 326747, 792843, 436868, 727041, 442403, 646014, 492801, 451725, 790955, 842973, 344514, 283596, 627106, 687229, 730102, 609888, 347912, 497298, 480780, 767821, 488978]

appealsCleaned = appealsCleaned + appeals_completed.pluck(:id)
=> [498649, 70285, 874977, 277520, 388713, 488971, 763937, 859327, 442244, 459664, 433732, 276261, 257174, 248425, 294731, 124301, 123868, 466100, 32740, 67720, 116362, 811566, 797195, 53349, 874986, 569457, 850300, 254335, 288, 276050, 681477, 847396, 481939, 778921, 54896, 733727, 458881, 782099, 264461, 103207, 386989, 469514]

orig_appeal_list = [510211, 32740, 498649, 552610, 70285, 525836, 225570, 781153, 794299, 769949, 275870, 515452, 386989, 305164, 580615, 861102, 442244, 874977, 53349, 254335, 196934, 330461, 782099, 394108, 194768, 473501, 358121, 299944, 67720, 392140, 584318, 116362, 827599, 788044, 669093, 811566, 797195, 874986, 264461, 302412, 553278, 277520, 827455, 553895, 339245, 564906, 499405, 569457, 442403, 514003, 362375, 40800, 458885, 202620, 135660, 344833, 323161, 106161, 352568, 500002, 32858, 469514, 447729, 458511, 448875, 850300, 424718, 478494, 796864, 42869, 288, 276050, 388713, 488971, 763937, 681477, 847396, 481939, 778921, 54896, 859327, 733727, 421415, 131321, 314858, 817334, 257174, 50020, 371362, 719168, 76779, 391108, 603004, 175523, 221219, 283596, 453675, 367152, 201224, 86727, 437156, 433732, 21436, 795591, 249986, 492965, 158974, 276261, 343599, 385528, 159214, 652546, 637667, 399413, 436080, 591666, 450156, 103207, 157726, 564865, 146504, 640573, 138276, 491146, 63560, 372398, 123419, 295144, 14178, 103450, 381133, 229530, 678280, 209060, 639276, 307333, 356992, 168739, 456076, 336381, 82507, 557625, 306487, 12876, 459664, 454263, 470153, 49757, 4359, 790955, 339996, 712334, 398611, 326747, 580019, 447423, 253479, 792843, 322454, 436868, 727041, 275970, 646014, 480780, 492801, 451725, 680551, 82724, 335453, 489907, 217262, 842973, 344514, 86611, 627106, 687229, 730102, 319184, 609888, 169069, 347912, 497298, 767821, 488978, 508866, 517772, 508865, 458881, 248425, 294731, 124301, 123868, 466100]

appealsCleaned - orig_appeal_list
=> []

No more open PreRoutingFoiaColocatedTasks:

appeals=PreRoutingFoiaColocatedTask.open.map(&:appeal);
=> []

appeals.count
=> 0

Data cleanup in prod related to this cleanup https://dsva.slack.com/archives/CHX8FMP28/p1599597483174600

Was this page helpful?
0 / 5 - 0 ratings