Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/state_file_archived_intake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class StateFileArchivedIntake < ApplicationRecord
has_many :state_file_archived_intake_requests, class_name: 'StateFileArchivedIntakeRequest'
enum contact_preference: { unfilled: 0, email: 1, text: 2 }, _prefix: :contact_preference

scope :for_pya, -> { where.not(hashed_ssn: nil) }

before_create :populate_fake_addresses
def full_address
address_parts = [mailing_street, mailing_apartment, mailing_city, mailing_state, mailing_zip]
Expand Down
2 changes: 1 addition & 1 deletion scripts/copy_to_new_s3_bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def copy
intakes_without_keys = []

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

intakes.each do |intake|
Expand Down
8 changes: 8 additions & 0 deletions spec/models/state_file_archived_intake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
require 'rails_helper'

RSpec.describe StateFileArchivedIntake, type: :model do
describe ".for_pya" do
let!(:state_file_archived_intake_with_ssn) { create :state_file_archived_intake }
let!(:state_file_archived_intake_without_ssn) { create :state_file_archived_intake, hashed_ssn: nil }
it "filters out records without a hashed_ssn" do
expect(described_class.for_pya.count).to be 1
end
end

describe "#increment_failed_attempts" do
let!(:state_file_archived_intake) { create :state_file_archived_intake, failed_attempts: 1 }
it "locks access when failed attempts is incremented to 2" do
Expand Down
Loading