From a4edef7cb5754abf2dcda09dd050c2d192381f2a Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 10 Jul 2023 12:15:36 +0100 Subject: [PATCH] Refactor --- app/models/lettings_log.rb | 3 +-- app/models/sales_log.rb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 971684bbb..7197b5fd4 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -54,9 +54,8 @@ 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 :duplicate_logs, lambda { |log| - where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) + visible.where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) .where.not(id: log.id) - .where.not(status: "deleted") .where.not("startdate IS NULL OR age1 IS NULL OR sex1 IS NULL OR ecstat1 IS NULL OR tcharge IS NULL OR postcode_full IS NULL OR propcode IS NULL OR needstype IS NULL") .where("location_id = ? OR needstype = 1", log.location_id) } diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 8039d845e..311ecc565 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -42,9 +42,8 @@ class SalesLog < Log } scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org) } scope :duplicate_logs, lambda { |log| - where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) + visible.where(log.slice(*DUPLICATE_LOG_ATTRIBUTES)) .where.not(id: log.id) - .where.not(status: "deleted") .where.not("saledate is NULL OR age1 IS NULL OR sex1 IS NULL OR ecstat1 IS NULL OR postcode_full IS NULL") }