Commit 1d6c14c4 authored by Tugce Nur Tas's avatar Tugce Nur Tas
Browse files

Merge branch 'fixes/external-volunteer-matching' into 'develop'

Fixes/external volunteer matching

See merge request !620
parents a30ef51c 58667c2d
Pipeline #18799 passed with stage
in 39 minutes and 46 seconds
......@@ -50,7 +50,7 @@ class Volunteer < ApplicationRecord
has_many :group_assignments, dependent: :delete_all
has_many :group_assignment_logs
has_many :group_offers, through: :group_assignments
# categories done in group offers
has_many :categories_from_group_assignments, through: :group_offers, source: :group_offer_category
......@@ -155,7 +155,7 @@ class Volunteer < ApplicationRecord
seeking_clients
}
scope :seeking_clients, lambda {
accepted.where(active: false).or(accepted.activeness_ended)
internal.accepted.where(active: false).or(internal.accepted.activeness_ended)
}
scope :seeking_clients_will_take_more, lambda {
seeking_clients.or(accepted.will_take_more_assignments)
......@@ -294,7 +294,7 @@ class Volunteer < ApplicationRecord
end
def seeking_clients?
accepted? && inactive? || take_more_assignments? && active?
internal? && (accepted? && inactive? || take_more_assignments? && active?)
end
def self.acceptance_collection
......
= simple_form_for(@department) do |f|
= simple_error_notice f
.row
.col-xs-12.col-md-6.department_assocable
- if policy(Department).can_associate_user?
- if policy(Department).can_associate_user?
.col-xs-12.col-md-6.department_assocable
= f.association :user, as: :check_boxes, collection: User.department_assocable.sort_by(&:to_s)
= f.simple_fields_for :contact do |c|
......
......@@ -11,9 +11,8 @@ nav.navbar.section-navigation
title: 'Beenden', method: :put unless @volunteer.resigned?
- if @volunteer.internal_and_started_assignments?
li = button_link navigation_glyph(:hours), volunteer_hours_path(@volunteer), title: t('volunteer_applications.show.hour_reports')
- if policy(Volunteer).superadmin_privileges?
- if @volunteer.seeking_clients?
li= button_link navigation_glyph(:assignment), find_client_volunteer_path(id: @volunteer), title: t('seeking_clients')
- if policy(Volunteer).superadmin_privileges? && @volunteer.seeking_clients?
li= button_link navigation_glyph(:assignment), find_client_volunteer_path(id: @volunteer), title: t('seeking_clients')
- if @volunteer.internal_and_started_assignments?
li= button_link navigation_glyph(:billing_expenses), volunteer_billing_expenses_path(@volunteer), title: 'Spesenformulare'
- if policy(Volunteer).superadmin_privileges?
......
......@@ -898,7 +898,7 @@ de:
relatives: Familienangehörige im Haushalt
remember_me: Angemeldet bleiben
reserve: Begleitung erstellen
seeking_clients: Klienten suchen
seeking_clients: Klient/in suchen
show_my_profile: Mein Profil
simple_form:
error_notification:
......
......@@ -338,4 +338,22 @@ class VolunteersTest < ApplicationSystemTestCase
visit edit_volunteer_path(@resigned)
assert page.has_field? 'Prozess', disabled: true
end
test 'external volunteer can not get machted with a client' do
@external = create :volunteer_external, acceptance: :accepted
visit volunteers_path
# "Klient/en" suchen button is not shown on volunteer index
within page.find('tr', text: @external.full_name) do
assert_text 'Nicht zuweisbar'
end
# "Klient/en" suchen button is not shown on volunteer show
visit volunteer_path(@external)
refute page.has_button? 'Klient/in suchen'
# "Klient/en" suchen button is not shown on volunteer edit
visit edit_volunteer_path(@external)
refute page.has_button? 'Klient/in suchen'
end
end
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