Browse Source

Remove schemes feature flag (#841)

pull/845/head
baarkerlounger 2 years ago committed by GitHub
parent
commit
6ff7db39f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/components/primary_navigation_component.rb
  2. 6
      app/models/derived_variables/case_log_variables.rb
  3. 1
      app/models/form/setup/pages/location.rb
  4. 1
      app/models/form/setup/pages/needs_type.rb
  5. 1
      app/models/form/setup/pages/rent_type.rb
  6. 1
      app/models/form/setup/pages/scheme.rb
  7. 1
      app/models/form/setup/questions/needs_type.rb
  8. 1
      app/models/form/setup/questions/scheme_id.rb
  9. 4
      config/initializers/feature_toggle.rb
  10. 7
      spec/models/case_log_spec.rb
  11. 1
      spec/models/form/setup/pages/location_spec.rb
  12. 4
      spec/models/form/setup/pages/needs_type_spec.rb
  13. 4
      spec/models/form/setup/pages/rent_type_spec.rb
  14. 4
      spec/models/form/setup/pages/scheme_spec.rb

1
app/components/primary_navigation_component.rb

@ -3,7 +3,6 @@ class PrimaryNavigationComponent < ViewComponent::Base
def initialize(items:)
@items = items
FeatureToggle.supported_housing_schemes_enabled? ? @items : @items.reject! { |nav_item| nav_item.text.include?("Schemes") }
super
end

6
app/models/derived_variables/case_log_variables.rb

@ -1,10 +1,6 @@
module DerivedVariables::CaseLogVariables
RENT_TYPE_MAPPING = { 0 => 1, 1 => 2, 2 => 2, 3 => 3, 4 => 3, 5 => 3 }.freeze
def supported_housing_schemes_enabled?
FeatureToggle.supported_housing_schemes_enabled?
end
def scheme_has_multiple_locations?
return false unless scheme
@ -15,8 +11,6 @@ module DerivedVariables::CaseLogVariables
def set_derived_fields!
# TODO: Remove once we support parent/child relationships
self.managing_organisation_id ||= owning_organisation_id
# TODO: Remove once we support supported housing logs
self.needstype = 1 unless supported_housing_schemes_enabled?
if rsnvac.present?
self.newprop = has_first_let_vacancy_reason? ? 1 : 2
end

1
app/models/form/setup/pages/location.rb

@ -4,7 +4,6 @@ class Form::Setup::Pages::Location < ::Form::Page
@header = ""
@description = ""
@depends_on = [{
"supported_housing_schemes_enabled?" => true,
"needstype" => 2,
"scheme_has_multiple_locations?" => true,
}]

1
app/models/form/setup/pages/needs_type.rb

@ -4,7 +4,6 @@ class Form::Setup::Pages::NeedsType < ::Form::Page
@id = "needs_type"
@header = ""
@description = ""
@depends_on = [{ "supported_housing_schemes_enabled?" => true }]
@subsection = subsection
end

1
app/models/form/setup/pages/rent_type.rb

@ -3,7 +3,6 @@ class Form::Setup::Pages::RentType < ::Form::Page
super("rent_type", hsh, subsection)
@header = ""
@description = ""
@depends_on = [{ "supported_housing_schemes_enabled?" => true }]
@derived = true
end

1
app/models/form/setup/pages/scheme.rb

@ -4,7 +4,6 @@ class Form::Setup::Pages::Scheme < ::Form::Page
@header = ""
@description = ""
@depends_on = [{
"supported_housing_schemes_enabled?" => true,
"needstype" => 2,
}]
end

1
app/models/form/setup/questions/needs_type.rb

@ -7,7 +7,6 @@ class Form::Setup::Questions::NeedsType < ::Form::Question
@hint_text = "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes."
@type = "radio"
@answer_options = ANSWER_OPTIONS
@derived = true unless FeatureToggle.supported_housing_schemes_enabled?
@page = page
end

1
app/models/form/setup/questions/scheme_id.rb

@ -6,7 +6,6 @@ class Form::Setup::Questions::SchemeId < ::Form::Question
@hint_text = "Enter scheme name or postcode"
@type = "select"
@answer_options = answer_options
@derived = true unless FeatureToggle.supported_housing_schemes_enabled?
@guidance_position = GuidancePosition::BOTTOM
@guidance_partial = "scheme_selection"
end

4
config/initializers/feature_toggle.rb

@ -1,8 +1,4 @@
class FeatureToggle
def self.supported_housing_schemes_enabled?
true
end
def self.startdate_two_week_validation_enabled?
true
end

7
spec/models/case_log_spec.rb

@ -2285,13 +2285,6 @@ RSpec.describe CaseLog do
end
end
describe "supported_housing_schemes_enabled?" do
it "returns true for the case log if the environment is not production" do
case_log = FactoryBot.create(:case_log)
expect(case_log.supported_housing_schemes_enabled?).to eq(true)
end
end
describe "csv download" do
let(:scheme) { FactoryBot.create(:scheme) }
let(:location) { FactoryBot.create(:location, :export, scheme:, type_of_unit: 6, postcode: "SE11TE") }

1
spec/models/form/setup/pages/location_spec.rb

@ -29,7 +29,6 @@ RSpec.describe Form::Setup::Pages::Location, type: :model do
it "has the correct depends_on" do
expect(page.depends_on).to eq([{
"supported_housing_schemes_enabled?" => true,
"needstype" => 2,
"scheme_has_multiple_locations?" => true,
}])

4
spec/models/form/setup/pages/needs_type_spec.rb

@ -26,8 +26,4 @@ RSpec.describe Form::Setup::Pages::NeedsType, type: :model do
it "has the correct description" do
expect(page.description).to eq("")
end
it "has the correct depends_on" do
expect(page.depends_on).to eq([{ "supported_housing_schemes_enabled?" => true }])
end
end

4
spec/models/form/setup/pages/rent_type_spec.rb

@ -26,8 +26,4 @@ RSpec.describe Form::Setup::Pages::RentType, type: :model do
it "has the correct description" do
expect(page.description).to eq("")
end
it "has the correct depends_on" do
expect(page.depends_on).to eq([{ "supported_housing_schemes_enabled?" => true }])
end
end

4
spec/models/form/setup/pages/scheme_spec.rb

@ -26,8 +26,4 @@ RSpec.describe Form::Setup::Pages::Scheme, type: :model do
it "has the correct description" do
expect(page.description).to eq("")
end
it "has the correct depends_on" do
expect(page.depends_on).to eq([{ "needstype" => 2, "supported_housing_schemes_enabled?" => true }])
end
end

Loading…
Cancel
Save