Browse Source

Performance (#810)

* Setup subsection is always enabled

* Cache setup subsection page generation

* Cache setup section page question generation
pull/811/head
baarkerlounger 2 years ago committed by GitHub
parent
commit
dd1dd974ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/models/form/setup/pages/created_by.rb
  2. 3
      app/models/form/setup/pages/location.rb
  3. 3
      app/models/form/setup/pages/needs_type.rb
  4. 3
      app/models/form/setup/pages/organisation.rb
  5. 3
      app/models/form/setup/pages/property_reference.rb
  6. 3
      app/models/form/setup/pages/renewal.rb
  7. 3
      app/models/form/setup/pages/rent_type.rb
  8. 3
      app/models/form/setup/pages/scheme.rb
  9. 3
      app/models/form/setup/pages/tenancy_start_date.rb
  10. 3
      app/models/form/setup/pages/tenant_code.rb
  11. 7
      app/models/form/setup/subsections/setup.rb

3
app/models/form/setup/pages/created_by.rb

@ -4,12 +4,11 @@ class Form::Setup::Pages::CreatedBy < ::Form::Page
@id = "created_by"
@header = ""
@description = ""
@questions = questions
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::CreatedById.new(nil, nil, self),
]
end

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

@ -3,7 +3,6 @@ class Form::Setup::Pages::Location < ::Form::Page
super("location", hsh, subsection)
@header = ""
@description = ""
@questions = questions
@depends_on = [{
"supported_housing_schemes_enabled?" => true,
"needstype" => 2,
@ -12,7 +11,7 @@ class Form::Setup::Pages::Location < ::Form::Page
end
def questions
[
@questions ||= [
Form::Setup::Questions::LocationId.new(nil, nil, self),
]
end

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

@ -4,13 +4,12 @@ class Form::Setup::Pages::NeedsType < ::Form::Page
@id = "needs_type"
@header = ""
@description = ""
@questions = questions
@depends_on = [{ "supported_housing_schemes_enabled?" => true }]
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::NeedsType.new(nil, nil, self),
]
end

3
app/models/form/setup/pages/organisation.rb

@ -4,12 +4,11 @@ class Form::Setup::Pages::Organisation < ::Form::Page
@id = "organisation"
@header = ""
@description = ""
@questions = questions
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::OwningOrganisationId.new(nil, nil, self),
]
end

3
app/models/form/setup/pages/property_reference.rb

@ -4,12 +4,11 @@ class Form::Setup::Pages::PropertyReference < ::Form::Page
@id = "property_reference"
@header = ""
@description = ""
@questions = questions
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::PropertyReference.new(nil, nil, self),
]
end

3
app/models/form/setup/pages/renewal.rb

@ -4,12 +4,11 @@ class Form::Setup::Pages::Renewal < ::Form::Page
@id = "renewal"
@header = ""
@description = ""
@questions = questions
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::Renewal.new(nil, nil, self),
]
end

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

@ -3,13 +3,12 @@ class Form::Setup::Pages::RentType < ::Form::Page
super("rent_type", hsh, subsection)
@header = ""
@description = ""
@questions = questions
@depends_on = [{ "supported_housing_schemes_enabled?" => true }]
@derived = true
end
def questions
[
@questions ||= [
Form::Setup::Questions::RentType.new(nil, nil, self),
Form::Setup::Questions::IrproductOther.new(nil, nil, self),
]

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

@ -3,7 +3,6 @@ class Form::Setup::Pages::Scheme < ::Form::Page
super("scheme", hsh, subsection)
@header = ""
@description = ""
@questions = questions
@depends_on = [{
"supported_housing_schemes_enabled?" => true,
"needstype" => 2,
@ -11,7 +10,7 @@ class Form::Setup::Pages::Scheme < ::Form::Page
end
def questions
[
@questions ||= [
Form::Setup::Questions::SchemeId.new(nil, nil, self),
]
end

3
app/models/form/setup/pages/tenancy_start_date.rb

@ -3,12 +3,11 @@ class Form::Setup::Pages::TenancyStartDate < ::Form::Page
super
@id = "tenancy_start_date"
@description = ""
@questions = questions
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::TenancyStartDate.new(nil, nil, self),
]
end

3
app/models/form/setup/pages/tenant_code.rb

@ -4,12 +4,11 @@ class Form::Setup::Pages::TenantCode < ::Form::Page
@id = "tenant_code"
@header = ""
@description = ""
@questions = questions
@subsection = subsection
end
def questions
[
@questions ||= [
Form::Setup::Questions::TenantCode.new(nil, nil, self),
]
end

7
app/models/form/setup/subsections/setup.rb

@ -3,12 +3,11 @@ class Form::Subsections::Setup < ::Form::Subsection
super
@id = "setup"
@label = "Set up this lettings log"
@pages = [pages]
@section = section
end
def pages
[
@pages ||= [
Form::Setup::Pages::Organisation.new(nil, nil, self),
Form::Setup::Pages::CreatedBy.new(nil, nil, self),
Form::Setup::Pages::NeedsType.new(nil, nil, self),
@ -26,6 +25,10 @@ class Form::Subsections::Setup < ::Form::Subsection
questions.select { |q| support_only_questions.include?(q.id) } + super
end
def enabled?(_case_log)
true
end
private
def support_only_questions

Loading…
Cancel
Save