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

Remove old-style hold code and db column #10896

Closed
2 tasks
lowellrex opened this issue May 28, 2019 · 7 comments · Fixed by #12964
Closed
2 tasks

Remove old-style hold code and db column #10896

lowellrex opened this issue May 28, 2019 · 7 comments · Fixed by #12964

Comments

@lowellrex
Copy link
Contributor

Completes the work from #9207.

Acceptance criteria:

@lowellrex
Copy link
Contributor Author

Still waiting on old-style holds to expire. Exactly 100 remaining!

select count(*)
, type
from tasks
where on_hold_duration is not null
  and status not in ('cancelled', 'completed')
  and updated_at = placed_on_hold_at
group by 2
order by 1 desc;
Count Type
81 ColocatedTask
18 NoShowHearingTask
1 HearingAdminActionOtherTask

@lowellrex
Copy link
Contributor Author

lowellrex commented Jul 24, 2019

Of the 84 open non-NoShowHearingTask tasks that have at one time been placed on an old-style hold, 29 have passed their hold expiration date. 28 of those 29 correctly have the "in_progress" status. I'm guessing the other task (HearingAdminActionOtherTask ID 201617) has not had its status updated because the user it is assigned to (ID 1955) has not logged in to Caseflow since 23 May 2019 and the task has not been picked up by the code in GenericQueue where the task's status would be updated. I think we should manually update the status of this task so that it can be acted on by members of the hearings management branch (the organization to which the parent task is assigned).

In addition, I think we should null out the "on_hold_duration" columns for all 29 tasks so that we don't prematurely take those tasks off hold if folks create child tasks from those tasks (one of the bugs mentioned in the tech spec--another bug predicted the issue we are in with HearingAdminActionOtherTask ID 201617 being stuck because somebody hasn't logged in to Caseflow for a long time!).

select id
, type
, status
, placed_on_hold_at +  on_hold_duration * interval '1 day' as old_style_hold_expiration
, placed_on_hold_at
, on_hold_duration
from tasks
where on_hold_duration is not null
  and status not in ('cancelled', 'completed')
  and type <> 'NoShowHearingTask'
order by old_style_hold_expiration asc;

TODO:

  • Update status of HearingAdminActionOtherTask ID 201617 to "in_progress"
  • Null out "on_hold_duration" of the 29 tasks past their old style hold deadlines
    • Make sure those 29 tasks don't have active children tasks (which would indicate that they should actually be on hold and that we've already encountered the premature hold-ending bug we are seeking to avoid).
  • Do more investigation into the status of the on hold NoShowHearingTasks that using the old style holds

@lowellrex
Copy link
Contributor Author

Currently have 53 tasks on hold using the old-style holds:

select id
, type
, status
, placed_on_hold_at +  on_hold_duration * interval '1 day' as old_style_hold_expiration
, placed_on_hold_at
, on_hold_duration
from tasks
where on_hold_duration is not null
  and status = 'on_hold'
order by old_style_hold_expiration asc;

@lowellrex
Copy link
Contributor Author

Down to 15 tasks on hold using the old style hold. Revisit this ticket in mid-September after nearly all old-style holds have expired.

image

@lomky
Copy link
Contributor

lomky commented Sep 5, 2019

Down to 6 tasks on hold using the old style hold.

Screenshot from 2019-09-05 13-56-01

@kevmo
Copy link
Contributor

kevmo commented Oct 17, 2019

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

Fields in Tasks table, placed_on_hold_at and on_hold_duration, switched to new system documented in new wiki (https://github.com/department-of-veterans-affairs/caseflow/wiki/Timed-Tasks).

Begin by ignoring on_hold_duration, then remove it later. placed_on_hold_at is still useful (updated when status is updated to on_hold - while imprecise, still often useful).

Probably could delete some tests.

If we wait to do this until after Nov 13, we don't have to worry about old-style hold. If we want to make transition before then, we will need to create new-style holds for old holds.

@ferristseng ferristseng added the Eng: Backend Work Group backend engineering task label Nov 14, 2019
@lowellrex
Copy link
Contributor Author

There are no more tasks on hold with the old-style hold! https://caseflow-looker.va.gov/sql/7vrsydq8xs2dd2

@hschallhorn hschallhorn self-assigned this Dec 10, 2019
va-bot pushed a commit that referenced this issue Dec 13, 2019
Resolves #10896

### Description
Removes the `on_hold_duration` in the task table

### Acceptance Criteria
- [ ] Code compiles correctly

### Testing Plan
1. Migration runs smoothly
```bash
bin/rails db:migrate
```
2. Tasks no longer have the `on_hold_duration` field
```ruby
Task.last.on_hold_duration
NoMethodError: undefined method `on_hold_duration' for #<JudgeDecisionReviewTask:0x00007fc33b35f6c8>
```

### Database Changes
* [x] Query profiling performed (eyeball Rails log, check bullet and fasterer output)
* [x] #appeals-schema notified with summary and link to this PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants