Commit 58667c2d authored by Tugce Nur Tas's avatar Tugce Nur Tas
Browse files

update seeking clients scope to be internal

parent 9f931ac5
Pipeline #18776 passed with stage
in 33 minutes and 36 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
......
......@@ -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? && !@volunteer.external
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?
......
......@@ -6,9 +6,9 @@ tr
= link_to 'Freiwillige/n hinzufügen',
group_assignments_path(group_assignment: { group_offer_id: @group_offer.id, volunteer_id: volunteer.id }),
class: 'btn btn-default', method: :post
- elsif volunteer.seeking_clients? && !volunteer.external
- elsif volunteer.seeking_clients?
= button_link 'Klient/in suchen', find_client_volunteer_path(id: volunteer)
- elsif volunteer.clients.any? && (volunteer.assignments.any? || volunteer.group_assignments.any?) && !volunteer.external
- elsif volunteer.clients.any? && (volunteer.assignments.any? || volunteer.group_assignments.any?)
= button_link t('.show_assignments'), volunteer_path(volunteer, anchor: 'assignments')
- else
= t('not_assignable')
......
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