From 15759e06029af38d9ba3fafcf0ab0692443a78e0 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 20 Oct 2023 12:59:31 +0100 Subject: [PATCH] feat: update filters view --- app/models/lettings_log.rb | 2 +- app/views/logs/_log_filters.html.erb | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 1bcca5496..0f91e5ead 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -61,7 +61,7 @@ class LettingsLog < Log scope :unresolved, -> { where(unresolved: true) } scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) } scope :filter_by_owning_organisation, ->(owning_organisation, _user = nil) { where(owning_organisation:) } - scope :filter_by_managing_organisation, ->(managing_organisation, _user = nil) { where(managing_organisation:) } + scope :filter_by_managing_organisation, ->(managing_organisation, _user = nil) { where(managing_organisation:) } scope :age1_answered, -> { where.not(age1: nil).or(where(age1_known: 1)) } scope :tcharge_answered, -> { where.not(tcharge: nil).or(where(household_charge: 1)).or(where(is_carehome: 1)) } scope :chcharge_answered, -> { where.not(chcharge: nil).or(where(is_carehome: [nil, 0])) } diff --git a/app/views/logs/_log_filters.html.erb b/app/views/logs/_log_filters.html.erb index 638d8ea5c..7feadf14b 100644 --- a/app/views/logs/_log_filters.html.erb +++ b/app/views/logs/_log_filters.html.erb @@ -42,13 +42,15 @@ category: "status", } %> - <%= render partial: "filters/checkbox_filter", - locals: { - f:, - options: needstype_filters, - label: "Needs type", - category: "needstypes", - } %> + <% if request.path.include?("/lettings-logs") %> + <%= render partial: "filters/checkbox_filter", + locals: { + f:, + options: needstype_filters, + label: "Needs type", + category: "needstypes", + } %> + <% end %> <% end %> <%= render partial: "filters/radio_filter", @@ -71,7 +73,7 @@ category: "assigned_to", } %> - <% if current_user.support? || current_user.organisation.stock_owners.count > 1 && request.path == "/lettings-logs" %> + <% if (current_user.support? || current_user.organisation.stock_owners.count > 1) && request.path == "/lettings-logs" %> <%= render partial: "filters/radio_filter", locals: { f:, options: {