Skip to content

Commit

Permalink
Fixed one time payment selection criterias
Browse files Browse the repository at this point in the history
  • Loading branch information
martent committed Dec 3, 2019
1 parent eb06fc0 commit 5bb6034
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/lib/economy/one_time_payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.all(interval)
Person
.joins(:municipality)
.where(municipalities: { our_municipality: true })
.where.not(transferred: true)
.where('transferred = ? or transferred is ?', false, nil)
.where('municipality_placement_migrationsverket_at between ? and ? ', interval[:from], interval[:to])
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@

expect(person.ssns).to be_empty
expect(person.dossier_numbers).to be_empty
expect(person.special_needs).to be false
expect(person.special_needs).to be_nil
expect(person.residence_permit_at).to be_nil
expect(person.checked_out_to_our_city).to be_nil
expect(person.temporary_permit_starts_at).to be_nil
expect(person.temporary_permit_ends_at).to be_nil
expect(person.citizenship_at).to be_nil
expect(person.transferred).to be false
expect(person.transferred).to be_nil
expect(person.municipality_placement_migrationsverket_at).to be_nil
expect(person.municipality_placement_comment).to be_nil
expect(person.deregistered_reason).to be_nil
Expand Down
5 changes: 5 additions & 0 deletions spec/unit/one_time_payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
describe 'class method all' do
it 'should return one person' do
person.save
interval[:from] = '2000-01-01'.to_date
p person.municipality
p person.transferred
p person.municipality_placement_migrationsverket_at
puts interval
expect(Economy::OneTimePayment.all(interval).count).to eq(1)
end
end
Expand Down

0 comments on commit 5bb6034

Please sign in to comment.