Browse Source

Refactor query

pull/2285/head
Kat 2 years ago
parent
commit
ddd4d3a2c5
  1. 3
      app/policies/location_policy.rb

3
app/policies/location_policy.rb

@ -89,8 +89,7 @@ private
def has_any_logs_in_editable_collection_period def has_any_logs_in_editable_collection_period
editable_from_date = FormHandler.instance.earliest_open_for_editing_collection_start_date editable_from_date = FormHandler.instance.earliest_open_for_editing_collection_start_date
editable_logs = LettingsLog.where(location_id: location.id).after_date(editable_from_date)
LettingsLog.where(location_id: location.id, startdate: nil).any? || editable_logs.any? LettingsLog.where(location_id: location.id).after_date(editable_from_date).or(LettingsLog.where(startdate: nil, location_id: location.id)).any?
end end
end end

Loading…
Cancel
Save