diff --git a/app/components/sales_log_summary_component.html.erb b/app/components/sales_log_summary_component.html.erb index 09181fc72..dd58f6a61 100644 --- a/app/components/sales_log_summary_component.html.erb +++ b/app/components/sales_log_summary_component.html.erb @@ -42,7 +42,7 @@
Created <% if log.created_by %> - + <% end %>
diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index a1094ee37..4662cf7ec 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -52,7 +52,7 @@ class LettingsLog < Log } scope :filter_by_before_startdate, ->(date) { where("lettings_logs.startdate >= ?", date) } scope :unresolved, -> { where(unresolved: true) } - scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) } + scope :filter_by_organisation, ->(org) { where(owning_organisation: org).or(where(managing_organisation: org)) } scope :duplicate_logs, lambda { |log| visible .where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) diff --git a/app/models/log.rb b/app/models/log.rb index 3a6361e36..04c3f1ca2 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -29,8 +29,8 @@ class Log < ApplicationRecord scope :visible, -> { where(status: %w[not_started in_progress completed]) } scope :exportable, -> { where(status: %w[not_started in_progress completed deleted]) } - scope :filter_by_status, ->(status, _user = nil) { where status: } - scope :filter_by_years, lambda { |years, _user = nil| + scope :filter_by_status, ->(status) { where status: } + scope :filter_by_years, lambda { |years| first_year = years.shift query = filter_by_year(first_year) years.each { |year| query = query.or(filter_by_year(year)) } @@ -38,11 +38,7 @@ class Log < ApplicationRecord } scope :filter_by_postcode, ->(postcode_full) { where("REPLACE(postcode_full, ' ', '') ILIKE ?", "%#{postcode_full.delete(' ')}%") } scope :filter_by_id, ->(id) { where(id:) } - scope :filter_by_user, lambda { |selected_user, user| - if !selected_user.include?("all") && user.present? - where(created_by: user) - end - } + scope :filter_by_user, ->(selected_user) { where(created_by: selected_user) } scope :filter_by_bulk_upload_id, lambda { |bulk_upload_id, user| joins(:bulk_upload) .where(bulk_upload: { id: bulk_upload_id, user: }) diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index ae76e32c3..053327563 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -40,7 +40,7 @@ class SalesLog < Log .or(filter_by_postcode(param)) .or(filter_by_id(param)) } - scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org) } + scope :filter_by_organisation, ->(org) { where(owning_organisation: org) } scope :duplicate_logs, lambda { |log| visible.where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) .where.not(id: log.id) diff --git a/app/services/filter_manager.rb b/app/services/filter_manager.rb index 09e08893b..17f0aae52 100644 --- a/app/services/filter_manager.rb +++ b/app/services/filter_manager.rb @@ -24,7 +24,7 @@ class FilterManager next if category == "organisation" && all_orgs next if category == "assigned_to" - logs = logs.public_send("filter_by_#{category}", values, user) + logs = logs.public_send("filter_by_#{category}", values) end logs = logs.order(created_at: :desc) if user.support?