Skip to content

Commit 3353628

Browse files
committed
add a scope to archived intakes that should be used when moving them over to pya
1 parent f123976 commit 3353628

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

app/models/state_file_archived_intake.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class StateFileArchivedIntake < ApplicationRecord
3030
has_many :state_file_archived_intake_requests, class_name: 'StateFileArchivedIntakeRequest'
3131
enum contact_preference: { unfilled: 0, email: 1, text: 2 }, _prefix: :contact_preference
3232

33+
scope :for_pya, -> { where.not(hashed_ssn: nil) }
34+
3335
before_create :populate_fake_addresses
3436
def full_address
3537
address_parts = [mailing_street, mailing_apartment, mailing_city, mailing_state, mailing_zip]

scripts/copy_to_new_s3_bucket.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def copy
2626
intakes_without_keys = []
2727

2828
# Default batch 1000 https://apidock.com/rails/ActiveRecord/Batches/find_in_batches
29-
StateFileArchivedIntake.find_in_batches.with_index do |intakes, batch|
29+
StateFileArchivedIntake.for_pya.find_in_batches.with_index do |intakes, batch|
3030
say "Processing group ##{batch}..."
3131

3232
intakes.each do |intake|

spec/models/state_file_archived_intake_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
require 'rails_helper'
2727

2828
RSpec.describe StateFileArchivedIntake, type: :model do
29+
describe ".for_pya" do
30+
let!(:state_file_archived_intake_with_ssn) { create :state_file_archived_intake }
31+
let!(:state_file_archived_intake_without_ssn) { create :state_file_archived_intake, hashed_ssn: nil }
32+
it "filters out records without a hashed_ssn" do
33+
expect(described_class.for_pya.count).to be 1
34+
end
35+
end
36+
2937
describe "#increment_failed_attempts" do
3038
let!(:state_file_archived_intake) { create :state_file_archived_intake, failed_attempts: 1 }
3139
it "locks access when failed attempts is incremented to 2" do

0 commit comments

Comments
 (0)