Commit 983ce4db authored by Zsolt Benke's avatar Zsolt Benke
Browse files

List assigments with_actively_registered_volunteer

parent 4122b7f8
Pipeline #21140 passed with stage
in 33 minutes and 41 seconds
......@@ -28,8 +28,10 @@ class ReminderMailingsController < ApplicationController
end
def new_half_year
@reminder_mailables = Assignment.submitted_since(params[:submitted_since]&.to_date)
@reminder_mailables += GroupAssignment.submitted_since(params[:submitted_since]&.to_date)
@reminder_mailables = Assignment.with_actively_registered_volunteer
.submitted_since(params[:submitted_since]&.to_date)
@reminder_mailables += GroupAssignment.with_actively_registered_volunteer
.submitted_since(params[:submitted_since]&.to_date)
@reminder_mailing = ReminderMailing.new(kind: 'half_year',
reminder_mailing_volunteers: @reminder_mailables)
if EmailTemplate.half_year.active.any?
......
......@@ -4,26 +4,38 @@ class ReminderMailingsTest < ApplicationSystemTestCase
def setup
really_destroy_with_deleted(GroupAssignment, GroupOffer, Volunteer, Client, User)
@superadmin = create :user
@volunteer_assignment = create :volunteer
@volunteer_assignment = create :volunteer_with_user
@group_offer = create :group_offer
@volunteer_group_offer = create :volunteer
@volunteer_group_offer = create :volunteer_with_user
@volunteer_assignment.user.update(last_sign_in_at: Time.now)
@volunteer_group_offer.user.update(last_sign_in_at: Time.now)
end
test 'group_assignment_and_assignment_elegible_for_half_year_reminder_mailing_are_includable' do
group_offer = create :group_offer
volunteer_assignment = create :volunteer
volunteer_group_offer = create :volunteer
assignment = create :assignment, period_start: 6.months.ago, period_end: nil,
volunteer: @volunteer_assignment
group_assignment = GroupAssignment.create(volunteer: @volunteer_group_offer, period_end: nil,
group_offer: @group_offer, period_start: 6.months.ago)
another_assignment = create :assignment, period_start: 6.months.ago, period_end: nil,
volunteer: volunteer_assignment
another_group_assignment = GroupAssignment.create(volunteer: volunteer_group_offer, period_end: nil,
group_offer: group_offer, period_start: 6.months.ago)
create :email_template_half_year
login_as @superadmin
visit reminder_mailings_path
page.find_all('a', text: 'Halbjahres Erinnerung erstellen').first.click
assert page.has_link? assignment.to_label, href: assignment_path(assignment)
assert page.has_link? assignment.volunteer.contact.full_name, href: volunteer_path(assignment.volunteer)
assert page.has_link? group_assignment.to_label, href: group_offer_path(group_assignment.group_offer)
assert page.has_link? group_assignment.volunteer.contact.full_name, href: volunteer_path(group_assignment.volunteer)
assert page.has_link? group_assignment.to_label,
href: group_offer_path(group_assignment.group_offer)
refute page.has_link? another_assignment.to_label, href: assignment_path(another_assignment)
refute page.has_link? another_assignment.volunteer.contact.full_name, href: volunteer_path(another_assignment.volunteer)
refute page.has_link? another_group_assignment.to_label, href: group_offer_path(another_group_assignment.group_offer)
refute page.has_link? another_group_assignment.volunteer.contact.full_name, href: volunteer_path(another_group_assignment.volunteer)
# All checkboxes are not checked?
refute page.find_all(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment