Skip to content

Commit

Permalink
Merge pull request #3423 from DFE-Digital/CAPT-1964/reset-slc-plans
Browse files Browse the repository at this point in the history
Remove falsely passed task
  • Loading branch information
rjlynch authored Nov 22, 2024
2 parents ba733e0 + 9db0eec commit 07faa93
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Run me with `rails runner db/data/20241121115931_remove_student_loan_plan_task_from_claims_with_no_slc_plan.rb`

# Put your Ruby code here
claim_ids = Claim
.select(:id)
.joins(:notes)
.joins(:tasks)
.where(student_loan_plan: nil)
.where("notes.body ilike ?", "%[SLC Student loan plan] - Matched%")
.where(tasks: {name: "student_loan_plan", passed: true})

tasks_to_destroy = Task.where(
claim_id: claim_ids,
name: "student_loan_plan",
passed: true
)

if tasks_to_destroy.count == 704
tasks_to_destroy.destroy_all
else
puts "Expected to find 704 tasks, but found #{tasks_to_destroy.count}"
end

0 comments on commit 07faa93

Please sign in to comment.