Browse Source

Remove needstype for support users on orgs page

pull/1998/head
Kat 3 years ago
parent
commit
d5f7275d4c
  1. 5
      app/helpers/filters_helper.rb
  2. 2
      app/views/logs/_log_filters.html.erb

5
app/helpers/filters_helper.rb

@ -116,7 +116,10 @@ module FiltersHelper
user.support? || org.stock_owners.count > 1 || (org.holds_own_stock? && org.stock_owners.count.positive?)
end
def logs_for_both_needstypes_present?
def logs_for_both_needstypes_present?(organisation)
return true if current_user.support? && organisation.blank?
return [1, 2].all? { |needstype| organisation.lettings_logs.visible.where(needstype:).count.positive? } if current_user.support?
[1, 2].all? { |needstype| current_user.lettings_logs.visible.where(needstype:).count.positive? }
end

2
app/views/logs/_log_filters.html.erb

@ -42,7 +42,7 @@
category: "status",
} %>
<% if (current_user.support? || logs_for_both_needstypes_present?) && user_or_org_lettings_path? %>
<% if logs_for_both_needstypes_present?(@organisation) && user_or_org_lettings_path? %>
<%= render partial: "filters/checkbox_filter",
locals: {
f:,

Loading…
Cancel
Save