Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit #start_on/#end_on to Role, remove FutureRole, Role#delete_on #163

Merged
merged 1 commit into from
Nov 15, 2024
Merged
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
4 changes: 2 additions & 2 deletions app/domain/statistics/vereinsmitglieder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def person_roles_per_layer_query
FROM roles
INNER JOIN "groups" "groups" ON "groups".id = roles.group_id
INNER JOIN "groups" layers ON layers.id = "groups".layer_group_id
WHERE layers.type = '#{Group::Regionalverein.sti_name}' AND
roles.deleted_at IS NULL AND
#{Role.active.arel.where_sql} AND
layers.type = '#{Group::Regionalverein.sti_name}' AND
roles.type IN (#{role_types_param})
GROUP BY "groups".layer_group_id,
roles.person_id
Expand Down
4 changes: 2 additions & 2 deletions spec/domain/abo_addresses/query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
abos = Fabricate(Group::DachvereinAbonnemente.name.to_sym, parent: groups(:dachverein))
abo = Fabricate(Group::DachvereinAbonnemente::Einzelabo.name.to_sym,
group: abos,
created_at: 2.years.ago).person
abo.roles.first.update!(deleted_at: 1.year.ago)
start_on: 2.years.ago,
end_on: 1.year.ago).person

is_expected.not_to include(abo)
end
Expand Down
10 changes: 5 additions & 5 deletions spec/domain/statistics/vereinsmitglieder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@
(1..6).each { |i| expect(subject.count(groups(:seeland), i)).to eq 0 }
end

it "does not count deleted roles" do
it "does not count ended roles" do
o = Fabricate(Group::Aktivmitglieder::Aktivmitglied.name.to_sym,
group: active,
created_at: 2.years.ago)
start_on: 2.years.ago,
end_on: 1.year.ago)
a = Fabricate(Group::Aktivmitglieder::AktivmitgliedOhneAbo.name.to_sym,
group: active,
person: people(:regio_aktiv),
created_at: 2.years.ago)
start_on: 2.years.ago,
end_on: 1.year.ago)
Fabricate(Group::Passivmitglieder::PassivmitgliedMitAbo.name.to_sym,
group: passive,
person: people(:regio_aktiv))
o.update!(deleted_at: 1.year.ago)
a.update!(deleted_at: 1.year.ago)

(0..5).each { |i| expect(subject.count(layer, i)).to eq 0 }
expect(subject.count(layer, 6)).to eq 1
Expand Down
Loading