Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

442 lines
12 KiB

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
# rubocop:disable Rails/Output
def create_data_protection_confirmation(user)
DataProtectionConfirmation.find_or_create_by!(
organisation: user.organisation,
confirmed: true,
data_protection_officer: user,
signed_at: Time.zone.local(2019, 1, 1),
data_protection_officer_email: user.email,
data_protection_officer_name: user.name,
)
end
unless Rails.env.test?
stock_owner1 = Organisation.find_or_create_by!(
name: "Stock Owner 1",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: true,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
stock_owner2 = Organisation.find_or_create_by!(
name: "Stock Owner 2",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: true,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
managing_agent1 = Organisation.find_or_create_by!(
name: "Managing Agent 1 (PRP)",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: true,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "PRP",
)
managing_agent2 = Organisation.find_or_create_by!(
name: "Managing Agent 2",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: true,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
org = Organisation.find_or_create_by!(
name: "DLUHC",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: true,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
) do
info = "Seeded DLUHC Organisation"
if Rails.env.development?
pp info
else
Rails.logger.info info
end
end
standalone_owns_stock = Organisation.find_or_create_by!(
name: "Standalone Owns Stock 1 Ltd",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: true,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
standalone_no_stock = Organisation.find_or_create_by!(
name: "Standalone No Stock 1 Ltd",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: false,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
User.find_or_create_by!(
name: "Provider Owns Stock",
email: "provider.owner1@example.com",
organisation: standalone_owns_stock,
role: "data_provider",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Coordinator Owns Stock",
email: "coordinator.owner1@example.com",
organisation: standalone_owns_stock,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Provider No Stock",
email: "provider.nostock@example.com",
organisation: standalone_no_stock,
role: "data_provider",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Coordinator No Stock",
email: "coordinator.nostock@example.com",
organisation: standalone_no_stock,
role: "data_coordinator",
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
end
User.find_or_create_by!(
name: "Stock owner 1",
email: "stock_owner1_dpo@example.com",
organisation: stock_owner1,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Stock owner 2",
email: "stock_owner2_dpo@example.com",
organisation: stock_owner2,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Managing agent 1",
email: "managing_agent1_dpo@example.com",
organisation: managing_agent1,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Managing agent 2",
email: "managing_agent2_dpo@example.com",
organisation: managing_agent2,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
OrganisationRelationship.find_or_create_by!(
parent_organisation: stock_owner1,
child_organisation: org,
)
OrganisationRelationship.find_or_create_by!(
parent_organisation: stock_owner2,
child_organisation: org,
)
OrganisationRelationship.find_or_create_by!(
parent_organisation: org,
child_organisation: managing_agent1,
)
OrganisationRelationship.find_or_create_by!(
parent_organisation: org,
child_organisation: managing_agent2,
)
if Rails.env.development? || Rails.env.review?
User.find_or_create_by!(
name: "Provider",
email: "provider@example.com",
organisation: org,
role: "data_provider",
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
end
User.find_or_create_by!(
name: "Coordinator",
email: "coordinator@example.com",
organisation: org,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
user.is_dpo = true
create_data_protection_confirmation(user)
end
support_user = User.find_or_create_by!(
name: "Support",
email: "support@example.com",
organisation: org,
role: "support",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
pp "Seeded dummy users"
end
if (Rails.env.development? || Rails.env.review?) && SalesLog.count.zero?
SalesLog.find_or_create_by!(
assigned_to: support_user,
owning_organisation: org,
managing_organisation: org,
saledate: Date.new(2023, 4, 1),
purchid: "1",
ownershipsch: 1,
type: 2,
jointpur: 1,
jointmore: 1,
)
SalesLog.find_or_create_by!(
assigned_to: support_user,
owning_organisation: org,
managing_organisation: org,
saledate: Date.new(2023, 4, 1),
purchid: "1",
ownershipsch: 2,
type: 9,
jointpur: 1,
jointmore: 1,
)
SalesLog.find_or_create_by!(
assigned_to: support_user,
owning_organisation: org,
managing_organisation: org,
saledate: Date.new(2023, 4, 1),
purchid: "1",
ownershipsch: 3,
type: 10,
companybuy: 1,
)
pp "Seeded a sales log of each type"
end
if Rails.env.development? || Rails.env.review?
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
dummy_org = Organisation.find_or_create_by!(
name: "FooBar LTD",
address_line1: "Higher Kingston",
address_line2: "Yeovil",
postcode: "BA21 4AT",
holds_own_stock: true,
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
other_stock_owners: "None",
managing_agents_label: "None",
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
provider_type: "LA",
)
pp "Seeded dummy FooBar LTD organisation"
User.find_or_create_by!(
name: "Dummy user",
email: "dummy_org@example.com",
organisation: dummy_org,
role: "data_provider",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
if (Rails.env.development? || Rails.env.review?) && Scheme.count.zero?
scheme1 = Scheme.create!(
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
service_name: "Beulahside Care",
sensitive: 0,
registered_under_care_act: 1,
support_type: 2,
scheme_type: 4,
intended_stay: "M",
primary_client_group: "O",
has_other_client_group: 1,
secondary_client_group: "H",
owning_organisation: org,
arrangement_type: "D",
confirmed: true,
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
created_at: Time.zone.now,
)
scheme2 = Scheme.create!(
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
service_name: "Abdullahview Point",
sensitive: 0,
registered_under_care_act: 1,
support_type: 2,
scheme_type: 5,
intended_stay: "S",
primary_client_group: "D",
secondary_client_group: "E",
has_other_client_group: 1,
owning_organisation: org,
arrangement_type: "D",
confirmed: true,
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
created_at: Time.zone.now,
)
Scheme.create!(
service_name: "Caspermouth Center",
sensitive: 1,
registered_under_care_act: 1,
support_type: 4,
scheme_type: 7,
intended_stay: "X",
primary_client_group: "G",
has_other_client_group: 1,
secondary_client_group: "R",
owning_organisation: dummy_org,
arrangement_type: "D",
confirmed: true,
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
created_at: Time.zone.now,
)
Location.create!(
scheme: scheme1,
CLDC-3014 Add schemes and locations csv download functionality (#2083) * feat: add schemes and locations download links and pages * feat: update current path helper * feat: update tests for different user visibility levels * feat: update search caption tests * refactor: lint tests * refactor: lint tests * git: revert unintentional inclusion * feat: update tests * refactor: lint * feat: DRY up routing * refactor: lint * feat: add csv confirmation view * feat: add scheme csv service * feat: rename * feat: update csv service * feat: update csv service * feat: update controller and rename view * feat: update view * refactor: lint * feat: show correct headers in csv * feat: add locations and combined csv behaviour * feat: remove redundant user instance variable * feat: add scheme csv service spec * feat: add scheme email csv job tests * feat: update filters in spec * refactor: move scheme_email_csv_job_spec.rb * feat: update spec * refactor: remove blank line * feat: add nowrap to all download links * feat: update org schemes controller with org schemes (and rename for clarity) * feat: update link indentation and spec * feat: only include location LA name, and rename to location_local_authority * feat: update seed locations with westminster local authorities to avoid similar confusion to some that arose in PO review * feat: display multiple active periods on a single line * feat: display multiple active periods on a single line * feat: update line spacing in search captions * feat: replace 2/3 with full column in download page * feat: move scheme alphabeticising into manager * feat: update tests now search/filterless copy has changed * refactor: lint * refactor: lint * refactor: lint * feat: add filter alphabeticising test * feat: correct spacing
11 months ago
location_code: "E09000033",
location_admin_district: "Westminster",
postcode: "CU193AA",
name: "Rectory Road",
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
type_of_unit: 4,
units: 1,
mobility_type: "N",
)
Location.create!(
scheme: scheme1,
CLDC-3014 Add schemes and locations csv download functionality (#2083) * feat: add schemes and locations download links and pages * feat: update current path helper * feat: update tests for different user visibility levels * feat: update search caption tests * refactor: lint tests * refactor: lint tests * git: revert unintentional inclusion * feat: update tests * refactor: lint * feat: DRY up routing * refactor: lint * feat: add csv confirmation view * feat: add scheme csv service * feat: rename * feat: update csv service * feat: update csv service * feat: update controller and rename view * feat: update view * refactor: lint * feat: show correct headers in csv * feat: add locations and combined csv behaviour * feat: remove redundant user instance variable * feat: add scheme csv service spec * feat: add scheme email csv job tests * feat: update filters in spec * refactor: move scheme_email_csv_job_spec.rb * feat: update spec * refactor: remove blank line * feat: add nowrap to all download links * feat: update org schemes controller with org schemes (and rename for clarity) * feat: update link indentation and spec * feat: only include location LA name, and rename to location_local_authority * feat: update seed locations with westminster local authorities to avoid similar confusion to some that arose in PO review * feat: display multiple active periods on a single line * feat: display multiple active periods on a single line * feat: update line spacing in search captions * feat: replace 2/3 with full column in download page * feat: move scheme alphabeticising into manager * feat: update tests now search/filterless copy has changed * refactor: lint * refactor: lint * refactor: lint * feat: add filter alphabeticising test * feat: correct spacing
11 months ago
location_code: "E09000033",
location_admin_district: "Westminster",
postcode: "DM250DC",
name: "Smithy Lane",
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
type_of_unit: 1,
units: 1,
mobility_type: "W",
)
Location.create!(
scheme: scheme2,
CLDC-3014 Add schemes and locations csv download functionality (#2083) * feat: add schemes and locations download links and pages * feat: update current path helper * feat: update tests for different user visibility levels * feat: update search caption tests * refactor: lint tests * refactor: lint tests * git: revert unintentional inclusion * feat: update tests * refactor: lint * feat: DRY up routing * refactor: lint * feat: add csv confirmation view * feat: add scheme csv service * feat: rename * feat: update csv service * feat: update csv service * feat: update controller and rename view * feat: update view * refactor: lint * feat: show correct headers in csv * feat: add locations and combined csv behaviour * feat: remove redundant user instance variable * feat: add scheme csv service spec * feat: add scheme email csv job tests * feat: update filters in spec * refactor: move scheme_email_csv_job_spec.rb * feat: update spec * refactor: remove blank line * feat: add nowrap to all download links * feat: update org schemes controller with org schemes (and rename for clarity) * feat: update link indentation and spec * feat: only include location LA name, and rename to location_local_authority * feat: update seed locations with westminster local authorities to avoid similar confusion to some that arose in PO review * feat: display multiple active periods on a single line * feat: display multiple active periods on a single line * feat: update line spacing in search captions * feat: replace 2/3 with full column in download page * feat: move scheme alphabeticising into manager * feat: update tests now search/filterless copy has changed * refactor: lint * refactor: lint * refactor: lint * feat: add filter alphabeticising test * feat: correct spacing
11 months ago
location_code: "E09000033",
location_admin_district: "Westminster",
postcode: "YX130WP",
name: "Smithy Lane",
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
type_of_unit: 2,
units: 1,
mobility_type: "W",
)
pp "Seeded dummy schemes"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
if LocalAuthority.count.zero?
la_path = "config/local_authorities_data/initial_local_authorities.csv"
service = Imports::LocalAuthoritiesService.new(path: la_path)
service.call
end
if (Rails.env.development? || Rails.env.review?) && LocalAuthorityLink.count.zero?
links_data_paths = ["config/local_authorities_data/local_authority_links_2023.csv", "config/local_authorities_data/local_authority_links_2022.csv"]
links_data_paths.each do |path|
service = Imports::LocalAuthorityLinksService.new(path:)
service.call
end
pp "Seeded local authority links"
end
if LaRentRange.count.zero?
Dir.glob("config/rent_range_data/*.csv").each do |path|
start_year = File.basename(path, ".csv")
service = Imports::RentRangesService.new(start_year:, path:)
service.call
end
end
if LaSaleRange.count.zero?
Dir.glob("config/sale_range_data/*.csv").each do |path|
start_year = File.basename(path, ".csv")
service = Imports::SaleRangesService.new(start_year:, path:)
service.call
end
end
end
if LocalAuthority.count.zero?
path = "config/local_authorities_data/initial_local_authorities.csv"
service = Imports::LocalAuthoritiesService.new(path:)
service.call
end
# rubocop:enable Rails/Output