|
|
|
@ -58,10 +58,10 @@ module Exports |
|
|
|
|
|
|
|
|
|
|
|
# these must be separate as activerecord struggles to join to two different name change tables in the same query |
|
|
|
# these must be separate as activerecord struggles to join to two different name change tables in the same query |
|
|
|
ids.concat( |
|
|
|
ids.concat( |
|
|
|
relation.left_joins(owning_organisation: :organisation_name_changes).where(owning_organisation: { organisation_name_changes: { created_at: range } }).pluck(:id), |
|
|
|
relation.left_joins(owning_organisation: :organisation_name_changes).where(owning_organisation: { organisation_name_changes: { updated_at: range } }).pluck(:id), |
|
|
|
) |
|
|
|
) |
|
|
|
ids.concat( |
|
|
|
ids.concat( |
|
|
|
relation.left_joins(managing_organisation: :organisation_name_changes).where(managing_organisation: { organisation_name_changes: { created_at: range } }).pluck(:id), |
|
|
|
relation.left_joins(managing_organisation: :organisation_name_changes).where(managing_organisation: { organisation_name_changes: { updated_at: range } }).pluck(:id), |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
LettingsLog.where(id: ids) |
|
|
|
LettingsLog.where(id: ids) |
|
|
|
|