Browse Source

Extract voiddate out of the if statement (#903)

CLDC-1474-sales-setup-ownership-scheme v0.2.10
kosiakkatrina 2 years ago committed by GitHub
parent
commit
ac3f864ad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/models/derived_variables/lettings_log_variables.rb
  2. 1
      spec/features/form/check_answers_page_spec.rb
  3. 1
      spec/features/form/validations_spec.rb
  4. 1
      spec/models/lettings_log_spec.rb

8
app/models/derived_variables/lettings_log_variables.rb

@ -59,14 +59,10 @@ module DerivedVariables::LettingsLogVariables
self.hhtype = household_type self.hhtype = household_type
self.new_old = new_or_existing_tenant self.new_old = new_or_existing_tenant
if is_supported_housing? if is_supported_housing? && location
if location
self.wchair = location.mobility_type_before_type_cast == "W" ? 1 : 2 self.wchair = location.mobility_type_before_type_cast == "W" ? 1 : 2
end end
if is_renewal? self.voiddate = startdate if is_renewal?
self.voiddate = startdate
end
end
self.vacdays = property_vacant_days self.vacdays = property_vacant_days
set_housingneeds_fields if housingneeds? set_housingneeds_fields if housingneeds?

1
spec/features/form/check_answers_page_spec.rb

@ -245,6 +245,7 @@ RSpec.describe "Form Check Answers Page" do
reason: 4, reason: 4,
ppostcode_full: "SE2 6RT", ppostcode_full: "SE2 6RT",
mrcdate: Time.zone.parse("03/11/2019"), mrcdate: Time.zone.parse("03/11/2019"),
renewal: 0,
) )
end end

1
spec/features/form/validations_spec.rb

@ -10,6 +10,7 @@ RSpec.describe "validations" do
:in_progress, :in_progress,
owning_organisation: user.organisation, owning_organisation: user.organisation,
managing_organisation: user.organisation, managing_organisation: user.organisation,
renewal: 0,
) )
end end
let(:empty_lettings_log) do let(:empty_lettings_log) do

1
spec/models/lettings_log_spec.rb

@ -1395,7 +1395,6 @@ RSpec.describe LettingsLog do
renewal: 1, renewal: 1,
startdate: Time.zone.local(2021, 4, 10), startdate: Time.zone.local(2021, 4, 10),
created_at: Time.utc(2022, 2, 8, 16, 52, 15), created_at: Time.utc(2022, 2, 8, 16, 52, 15),
needstype: 2,
}) })
end end

Loading…
Cancel
Save