diff --git a/app/jobs/invoices/abacus/transmit_all_members_job.rb b/app/jobs/invoices/abacus/transmit_all_members_job.rb index 827a54fc0..c80b95589 100644 --- a/app/jobs/invoices/abacus/transmit_all_members_job.rb +++ b/app/jobs/invoices/abacus/transmit_all_members_job.rb @@ -48,7 +48,7 @@ def failure(job) end def member_ids - Person.joins(:roles_unscoped) + Person.joins(:roles) .where(roles: {type: ROLES_TO_TRANSMIT.map(&:sti_name)}) .where.not(data_quality: :error) .distinct diff --git a/spec/jobs/invoices/abacus/transmit_all_members_job_spec.rb b/spec/jobs/invoices/abacus/transmit_all_members_job_spec.rb index 1ae7b78d5..11a1bae1c 100644 --- a/spec/jobs/invoices/abacus/transmit_all_members_job_spec.rb +++ b/spec/jobs/invoices/abacus/transmit_all_members_job_spec.rb @@ -29,7 +29,10 @@ end let(:unexpected_people) do - Fabricate.times(2, :person) + Fabricate(:person) # no role + Group::SektionsFunktionaere::Administration.create!(person: Fabricate(:person), group: groups(:bluemlisalp_funktionaere)) # other role + Group::SektionsMitglieder::Mitglied.create!(person: Fabricate(:person), group: groups(:bluemlisalp_mitglieder), start_on: 60.years.ago, end_on: 5.years.ago) # old member + Group::AboMagazin::Abonnent.create!(person: Fabricate(:person), group: groups(:abo_die_alpen), start_on: 5.years.ago, end_on: 2.years.ago) # old abonnent Group::AboMagazin::Neuanmeldung.create!(person: Fabricate(:person), group: groups(:abo_die_alpen)) end