Browse Source

Always show filter for support, only check visible logs

pull/1998/head
Kat 3 years ago
parent
commit
fd124f6af7
  1. 2
      app/helpers/filters_helper.rb
  2. 2
      app/views/logs/_log_filters.html.erb
  3. 4
      spec/features/user_spec.rb

2
app/helpers/filters_helper.rb

@ -117,7 +117,7 @@ module FiltersHelper
end
def logs_for_both_needstypes_present?
[1, 2].all? { |needstype| current_user.lettings_logs.where(needstype:).count.positive? }
[1, 2].all? { |needstype| current_user.lettings_logs.visible.where(needstype:).count.positive? }
end
def non_support_with_multiple_owning_orgs?

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

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

4
spec/features/user_spec.rb

@ -756,10 +756,10 @@ RSpec.describe "User Features" do
expect(page).to have_field("owning-organisation-field", with: "")
find("#owning-organisation-field").click.native.send_keys("F", "i", "l", "t", :down, :enter)
click_button("Apply filters")
expect(page).to have_current_path("/lettings-logs?%5Byears%5D%5B%5D=&%5Bstatus%5D%5B%5D=&assigned_to=all&owning_organisation_select=specific_org&owning_organisation=#{parent_organisation.id}&managing_organisation_select=all")
expect(page).to have_current_path("/lettings-logs?%5Byears%5D%5B%5D=&%5Bstatus%5D%5B%5D=&%5Bneedstypes%5D%5B%5D=&assigned_to=all&owning_organisation_select=specific_org&owning_organisation=#{parent_organisation.id}&managing_organisation_select=all")
choose("owning-organisation-select-all-field", allow_label_click: true)
click_button("Apply filters")
expect(page).to have_current_path("/lettings-logs?%5Byears%5D%5B%5D=&%5Bstatus%5D%5B%5D=&assigned_to=all&owning_organisation_select=all&managing_organisation_select=all")
expect(page).to have_current_path("/lettings-logs?%5Byears%5D%5B%5D=&%5Bstatus%5D%5B%5D=&%5Bneedstypes%5D%5B%5D=&assigned_to=all&owning_organisation_select=all&managing_organisation_select=all")
end
end
end

Loading…
Cancel
Save