Browse Source

locations and schemes only affect visible logs

pull/1503/head
Phil Lee 3 years ago
parent
commit
70099a37ac
  1. 4
      app/controllers/locations_controller.rb
  2. 4
      app/controllers/schemes_controller.rb

4
app/controllers/locations_controller.rb

@ -158,7 +158,7 @@ class LocationsController < ApplicationController
end end
def deactivate_confirm def deactivate_confirm
@affected_logs = @location.lettings_logs.filter_by_before_startdate(params[:deactivation_date]) @affected_logs = @location.lettings_logs.visible.filter_by_before_startdate(params[:deactivation_date])
if @affected_logs.count.zero? if @affected_logs.count.zero?
deactivate deactivate
else else
@ -260,7 +260,7 @@ private
end end
def reset_location_and_scheme_for_logs! def reset_location_and_scheme_for_logs!
logs = @location.lettings_logs.filter_by_before_startdate(params[:deactivation_date].to_time) logs = @location.lettings_logs.visible.filter_by_before_startdate(params[:deactivation_date].to_time)
logs.update!(location: nil, scheme: nil, unresolved: true) logs.update!(location: nil, scheme: nil, unresolved: true)
logs logs
end end

4
app/controllers/schemes_controller.rb

@ -39,7 +39,7 @@ class SchemesController < ApplicationController
end end
def deactivate_confirm def deactivate_confirm
@affected_logs = @scheme.lettings_logs.filter_by_before_startdate(params[:deactivation_date]) @affected_logs = @scheme.lettings_logs.visible.filter_by_before_startdate(params[:deactivation_date])
if @affected_logs.count.zero? if @affected_logs.count.zero?
deactivate deactivate
else else
@ -310,7 +310,7 @@ private
end end
def reset_location_and_scheme_for_logs! def reset_location_and_scheme_for_logs!
logs = @scheme.lettings_logs.filter_by_before_startdate(params[:deactivation_date].to_time) logs = @scheme.lettings_logs.visible.filter_by_before_startdate(params[:deactivation_date].to_time)
logs.update!(location: nil, scheme: nil, unresolved: true) logs.update!(location: nil, scheme: nil, unresolved: true)
logs logs
end end

Loading…
Cancel
Save