-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explicit #start_on/#end_on to Role, remove FutureRole, Role#delet…
…e_on
- Loading branch information
1 parent
3793e0d
commit fb19a46
Showing
3 changed files
with
61 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,18 +57,18 @@ | |
expect(person.magazin_abo_number).to eq(1000) | ||
expect(person.name_add_on).to eq('Mustermann') | ||
expect(person.email).to eq('[email protected]') | ||
expect(person.roles.with_deleted.count).to eq(2) | ||
expect(person.roles.with_inactive.count).to eq(2) | ||
|
||
mitglied = person.roles.first | ||
magazin_abo = person.roles.with_deleted.last | ||
magazin_abo = person.roles.with_inactive.last | ||
|
||
expect(mitglied.type).to eq(Group::Mitglieder::Aktivmitglied.sti_name) | ||
expect(mitglied.created_at).to eq(DateTime.new(1977, 1, 1)) | ||
expect(mitglied.deleted_at).to be_nil | ||
expect(mitglied.start_on).to eq(DateTime.new(1977, 1, 1)) | ||
expect(mitglied.end_on).to be_nil | ||
|
||
expect(magazin_abo.type).to eq(Group::Mitglieder::MagazinAbonnent.sti_name) | ||
expect(magazin_abo.created_at).to eq(DateTime.new(1990, 10, 12)) | ||
expect(magazin_abo.deleted_at).to eq(DateTime.new(2006, 2, 12)) | ||
expect(magazin_abo.start_on).to eq(DateTime.new(1990, 10, 12)) | ||
expect(magazin_abo.end_on).to eq(DateTime.new(2006, 2, 12)) | ||
|
||
expect(person.taggings.count).to eq(3) | ||
|
||
|
@@ -107,30 +107,30 @@ | |
expect(person.additional_emails.first.email).to eq('[email protected]') | ||
end | ||
|
||
it "sets role created_at on a day before deleted_at if not set" do | ||
it "sets role start_on on a day before end_on if not set" do | ||
expect do | ||
Rake::Task["import:people_fo"].invoke(groups(:berner_wanderwege).id) | ||
end.to output("Successfully imported 5/5 rows\n").to_stdout | ||
|
||
person = Person.find_by(alabus_id: 'dcwe1-vbsdw2-2cib1kbs-p-g2bnbw1h-2sd') | ||
expect(person).to be_present | ||
|
||
expect(person.roles.without_deleted.count).to eq(0) | ||
expect(person.roles.with_deleted.count).to eq(2) | ||
expect(person.roles.active.count).to eq(0) | ||
expect(person.roles.with_inactive.count).to eq(2) | ||
|
||
mitglied = person.roles.with_deleted.first | ||
magazin_abo = person.roles.with_deleted.last | ||
mitglied = person.roles.with_inactive.first | ||
magazin_abo = person.roles.with_inactive.last | ||
|
||
expect(mitglied.type).to eq(Group::Mitglieder::Aktivmitglied.sti_name) | ||
expect(mitglied.created_at).to eq(DateTime.new(2002, 11, 29)) | ||
expect(mitglied.deleted_at).to eq(DateTime.new(2002, 11, 30)) | ||
expect(mitglied.start_on).to eq(DateTime.new(2002, 11, 29)) | ||
expect(mitglied.end_on).to eq(DateTime.new(2002, 11, 30)) | ||
|
||
expect(magazin_abo.type).to eq(Group::Mitglieder::MagazinAbonnent.sti_name) | ||
expect(magazin_abo.created_at).to eq(DateTime.new(1998, 12, 31)) | ||
expect(magazin_abo.deleted_at).to eq(DateTime.new(1999, 1, 1)) | ||
expect(magazin_abo.start_on).to eq(DateTime.new(1998, 12, 31)) | ||
expect(magazin_abo.end_on).to eq(DateTime.new(1999, 1, 1)) | ||
end | ||
|
||
it "imports role only if created_at can be set" do | ||
it "imports role only if start_on can be set" do | ||
expect do | ||
Rake::Task["import:people_fo"].invoke(groups(:berner_wanderwege).id) | ||
end.to output("Successfully imported 5/5 rows\n").to_stdout | ||
|
@@ -139,9 +139,9 @@ | |
person_with_one_role = Person.find_by(alabus_id: '1s23w-b52n1x-2ciw2kjn-g-g213bwvh-1x7') | ||
person_without_roles = Person.find_by(alabus_id: 'bew31-axzcd1-jbhox23z-z-jtxn23wd1-k3g') | ||
|
||
expect(person_with_two_roles.roles.with_deleted.count).to eq(2) | ||
expect(person_with_one_role.roles.with_deleted.count).to eq(1) | ||
expect(person_without_roles.roles.with_deleted.count).to eq(0) | ||
expect(person_with_two_roles.roles.with_inactive.count).to eq(2) | ||
expect(person_with_one_role.roles.with_inactive.count).to eq(1) | ||
expect(person_without_roles.roles.with_inactive.count).to eq(0) | ||
end | ||
|
||
it "assigns Schweiz as fallback country" do | ||
|
@@ -231,7 +231,7 @@ | |
expect(invoice.state).to eq('issued') | ||
expect(invoice.esr_number).to eq('00 37592 44815 05725 00000 00013') | ||
expect(invoice.sent_at).to eq(DateTime.new(2022, 3, 28)) | ||
expect(invoice.created_at).to eq(DateTime.new(2022, 3, 28)) | ||
expect(invoice.start_on).to eq(DateTime.new(2022, 3, 28)) | ||
|
||
expect(invoice.invoice_items.count).to eq(1) | ||
|
||
|
@@ -257,7 +257,7 @@ | |
|
||
expected_output = ['Successfully imported 2/2 rows', | ||
'ROWS WITH STATUS OTHER THAN "Offen":', | ||
"esr_number: 00 34519 87043 97732 00000 00013, sent_at: 10.02.2022, created_at: 10.02.2022, alabus_id: wi2bn3f-tfbw3v-js1swvzh-h-jx75x634-beje, amount: 75\n"].join("\n") | ||
"esr_number: 00 34519 87043 97732 00000 00013, sent_at: 10.02.2022, start_on: 10.02.2022, alabus_id: wi2bn3f-tfbw3v-js1swvzh-h-jx75x634-beje, amount: 75\n"].join("\n") | ||
|
||
expect do | ||
Rake::Task["import:invoices_fo"].invoke(groups(:berner_wanderwege).id) | ||
|
@@ -308,12 +308,12 @@ | |
|
||
expected_output = ['Successfully imported 0/4 rows', | ||
'ROWS WITH STATUS OTHER THAN "Offen":', | ||
'esr_number: 00 34519 87043 97732 00000 00013, sent_at: 10.02.2022, created_at: 10.02.2022, alabus_id: wi2bn3f-tfbw3v-js1swvzh-h-jx75x634-beje, amount: 75', | ||
'esr_number: 00 34519 87043 97732 00000 00013, sent_at: 10.02.2022, start_on: 10.02.2022, alabus_id: wi2bn3f-tfbw3v-js1swvzh-h-jx75x634-beje, amount: 75', | ||
'FAILED ROWS:', | ||
'esr_number: 00 37592 44815 05725 00000 00013, sent_at: 28.03.2022, created_at: 28.03.2022, alabus_id: 5c2o3xc-twcwrv-js1wkcxh-h-jsax76d7-bew1, amount: 75, failing_note: person not found', | ||
"esr_number: 00 65823 21284 96217 00000 00013, sent_at: 13.03.2022, created_at: 13.03.2022, alabus_id: wi2bhef-tfcdxv-vcewwcvh-h-jx23x667-ghee, amount: , failing_note: invoice not found after reload", | ||
"esr_number: 00 43914 69124 312592 00000 00013, sent_at: 25.03.2022, created_at: 25.03.2022, alabus_id: , amount: 100, failing_note: id not present", | ||
"esr_number: , sent_at: , created_at: , alabus_id: wi2523f-t431xg-57eww221-h-j634x6sd-ghae, amount: 100, failing_note: Gültigkeitsprüfung ist fehlgeschlagen: Referenz Nummer muss ausgefüllt werden\n", | ||
'esr_number: 00 37592 44815 05725 00000 00013, sent_at: 28.03.2022, start_on: 28.03.2022, alabus_id: 5c2o3xc-twcwrv-js1wkcxh-h-jsax76d7-bew1, amount: 75, failing_note: person not found', | ||
"esr_number: 00 65823 21284 96217 00000 00013, sent_at: 13.03.2022, start_on: 13.03.2022, alabus_id: wi2bhef-tfcdxv-vcewwcvh-h-jx23x667-ghee, amount: , failing_note: invoice not found after reload", | ||
"esr_number: 00 43914 69124 312592 00000 00013, sent_at: 25.03.2022, start_on: 25.03.2022, alabus_id: , amount: 100, failing_note: id not present", | ||
"esr_number: , sent_at: , start_on: , alabus_id: wi2523f-t431xg-57eww221-h-j634x6sd-ghae, amount: 100, failing_note: Gültigkeitsprüfung ist fehlgeschlagen: Referenz Nummer muss ausgefüllt werden\n", | ||
"nothing was imported due to errors. Please fix import source file and try again.\n"].join("\n") | ||
|
||
|
||
|
@@ -381,7 +381,7 @@ | |
expect(person.language).to eq('fr') | ||
expect(person.valid_password?('great_password')).to eq(true) | ||
|
||
expect(person.roles.with_deleted.count).to eq(1) | ||
expect(person.roles.with_inactive.count).to eq(1) | ||
|
||
role = Group::Benutzerkonten::Benutzerkonto.find_by(person_id: person.id, | ||
group_id: benutzerkonten_group.id) | ||
|