Browse Source

CLDC 3414 update homepage (#2408)

* create presenter class to hold all the db calls and data for showing the home page
plus tests, some changes to factoreis and helpers necessary
this should avoid an overly bloated controller method or calling the DB from a view helper

* view partial changes
to accommodate design changes, decouple box with counter and blue link boxes
since various boxes show or not or in a different order depending on whether the org logs sales and whether we are in the crossover period I have also made grid and row partials to improve readability on the index page.

* redesign the home page using the new presenter and partials, deliver the presenter object to the view from the controller

* adjust tests and factories and address api call stub

* remove view helpers that are no longer being used and remove outdated tests for home page

* amend presenter and associated calls from view, tests, to ensure support user always sees sales data

* write request specs for the homepage

* undo unnecessary change to factory

* make corrections following rebase conflicts

* various minor changes following tech review

* logs assigned to a provider should be vivisble to them in the homepage count rather than logs created by them

* resolve rebase confusion in csv fixture files
pull/2435/head v0.4.43
Arthur Campbell 8 months ago committed by GitHub
parent
commit
47378cf7df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      app/controllers/start_controller.rb
  2. 26
      app/frontend/styles/_data_box.scss
  3. 76
      app/helpers/home_helper.rb
  4. 109
      app/presenters/homepage_presenter.rb
  5. 3
      app/views/home/_blue_box_link.html.erb
  6. 7
      app/views/home/_data_box.html.erb
  7. 8
      app/views/home/_data_box_row_of_two.html.erb
  8. 8
      app/views/home/_data_box_two_by_two.html.erb
  9. 108
      app/views/home/index.html.erb
  10. 6
      db/schema.rb
  11. 16
      spec/factories/lettings_log.rb
  12. 9
      spec/factories/sales_log.rb
  13. 5
      spec/factories/user.rb
  14. 2
      spec/features/form/tasklist_page_spec.rb
  15. 332
      spec/features/home_page_spec.rb
  16. 2
      spec/fixtures/exports/general_needs_log.csv
  17. 2
      spec/fixtures/exports/general_needs_log.xml
  18. 2
      spec/fixtures/exports/general_needs_log_24_25.xml
  19. 2
      spec/fixtures/files/lettings_log_csv_export_codes_23.csv
  20. 2
      spec/fixtures/files/lettings_log_csv_export_codes_24.csv
  21. 2
      spec/fixtures/files/lettings_log_csv_export_labels_23.csv
  22. 2
      spec/fixtures/files/lettings_log_csv_export_labels_24.csv
  23. 2
      spec/fixtures/files/lettings_log_csv_export_non_support_codes_23.csv
  24. 2
      spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv
  25. 2
      spec/fixtures/files/lettings_log_csv_export_non_support_labels_23.csv
  26. 2
      spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv
  27. 28
      spec/models/lettings_log_spec.rb
  28. 312
      spec/presenters/homepage_presenter_spec.rb
  29. 3
      spec/request_helper.rb
  30. 307
      spec/requests/start_controller_spec.rb
  31. 2
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
  32. 2
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

1
app/controllers/start_controller.rb

@ -1,6 +1,7 @@
class StartController < ApplicationController
def index
if current_user
@homepage_presenter = HomepagePresenter.new(current_user)
render "home/index"
end
end

26
app/frontend/styles/_data_box.scss

@ -1,11 +1,15 @@
.app-data-box-group {
.app-data-box-section {
@include govuk-font($size: 19);
font-weight: bold;
white-space: nowrap;
}
.app-data-box-group {
@include govuk-responsive-margin(4, "top");
}
@media (min-width: 54.0625em) {
.app-data-box-group-one-third {
.app-data-box-group-row {
display: flex;
justify-content: space-between;
column-gap: govuk-spacing(4);
@ -13,32 +17,20 @@
min-width: 733.33px;
}
}
@media (min-width: 54.0625em) {
.app-data-box-one-third {
width: 33.3333%;
float: left;
}
}
@media (min-width: 54.0625em) {
.app-data-box__underline {
min-width: 733.33px;
}
}
@media (min-width: 54.0625em) {
.app-data-box-group-one-half {
display: flex;
justify-content: space-between;
column-gap: govuk-spacing(4);
width: 100%;
min-width: 733.33px;
}
}
@media (min-width: 54.0625em) {
.app-data-box-one-half {
width: 50%;
float: left;
}
}
@media (min-width: 54.0625em) {
.app-data-box-one-half__underline {
min-width: 733.33px;

76
app/helpers/home_helper.rb

@ -1,76 +0,0 @@
module HomeHelper
def data_count(user, type)
lettings_years = FormHandler.instance.lettings_in_crossover_period? ? [current_collection_start_year, previous_collection_start_year] : [current_collection_start_year]
sales_years = FormHandler.instance.sales_in_crossover_period? ? [current_collection_start_year, previous_collection_start_year] : [current_collection_start_year]
if user.data_provider?
case type
when "lettings" then user.lettings_logs.where(assigned_to: user).where(status: %i[in_progress]).filter_by_years(lettings_years).count
when "sales" then user.sales_logs.where(assigned_to: user).where(status: %i[in_progress]).filter_by_years(sales_years).count
when "misc" then user.lettings_logs.completed.where(assigned_to: user).count
end
else
case type
when "lettings" then user.lettings_logs.where(status: %i[in_progress]).filter_by_years(lettings_years).count
when "sales" then user.sales_logs.where(status: %i[in_progress]).filter_by_years(sales_years).count
when "schemes" then user.schemes.incomplete.count
end
end
end
def heading_for_user_role(user)
ROLE_HEADINGS[user.role]
end
def data_subheading(user, type)
case type
when "schemes"
"Incomplete schemes"
when "misc"
"Your completed lettings"
else
"#{user.role == 'data_provider' ? :"Your " : nil}#{type} in progress".capitalize
end
end
def data_path(user, type)
lettings_years = FormHandler.instance.lettings_in_crossover_period? ? [current_collection_start_year, previous_collection_start_year] : [current_collection_start_year]
sales_years = FormHandler.instance.sales_in_crossover_period? ? [current_collection_start_year, previous_collection_start_year] : [current_collection_start_year]
if user.data_provider?
case type
when "lettings" then lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: lettings_years, owning_organisation_select: "all", managing_organisation_select: "all")
when "sales" then sales_logs_path(status: %i[in_progress], assigned_to: "you", years: sales_years, owning_organisation_select: "all", managing_organisation_select: "all")
when "misc" then lettings_logs_path(status: [:completed], assigned_to: "you", years: [""], owning_organisation_select: "all", managing_organisation_select: "all")
end
else
case type
when "lettings" then lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: lettings_years, owning_organisation_select: "all", managing_organisation_select: "all")
when "sales" then sales_logs_path(status: %i[in_progress], assigned_to: "all", years: sales_years, owning_organisation_select: "all", managing_organisation_select: "all")
when "schemes" then schemes_path(status: [:incomplete], owning_organisation_select: "all")
end
end
end
def view_all_path(type)
case type
when "lettings" then clear_filters_path(filter_type: "lettings_logs")
when "sales" then clear_filters_path(filter_type: "sales_logs")
when "schemes" then clear_filters_path(filter_type: "schemes")
when "misc" then clear_filters_path(filter_type: "schemes")
end
end
def view_all_text(type)
if type == "misc"
"View all schemes"
else
"View all #{type}"
end
end
ROLE_HEADINGS = {
"data_provider" => "Complete your logs",
"data_coordinator" => "Manage your data",
"support" => "Manage all data",
}.freeze
end

109
app/presenters/homepage_presenter.rb

@ -0,0 +1,109 @@
class HomepagePresenter
include Rails.application.routes.url_helpers
include CollectionTimeHelper
attr_reader :current_year_in_progress_lettings_data, :current_year_completed_lettings_data, :current_year_in_progress_sales_data, :current_year_completed_sales_data, :last_year_in_progress_lettings_data, :last_year_completed_lettings_data, :last_year_in_progress_sales_data, :last_year_completed_sales_data, :incomplete_schemes_data
def initialize(user)
@user = user
@display_sales = should_display_sales?
@in_crossover_period = FormHandler.instance.in_crossover_period?
@current_year = current_collection_start_year
@current_year_in_progress_lettings_data = data_box_data(:lettings, @current_year, :in_progress)
@current_year_completed_lettings_data = data_box_data(:lettings, @current_year, :completed)
@current_year_in_progress_sales_data = data_box_data(:sales, @current_year, :in_progress) if display_sales?
@current_year_completed_sales_data = data_box_data(:sales, @current_year, :completed) if display_sales?
@last_year = @current_year - 1
@last_year_in_progress_lettings_data = data_box_data(:lettings, @last_year, :in_progress) if in_crossover_period?
@last_year_completed_lettings_data = data_box_data(:lettings, @last_year, :completed)
@last_year_in_progress_sales_data = data_box_data(:sales, @last_year, :in_progress) if in_crossover_period? && display_sales?
@last_year_completed_sales_data = data_box_data(:sales, @last_year, :completed) if display_sales?
if display_schemes?
@incomplete_schemes_data = {
count: @user.schemes.incomplete.count,
text: data_box_text(type: :schemes, status: :incomplete),
path: schemes_path(status: [:incomplete], owning_organisation_select: "all"),
}
end
end
def title_text_for_user
if @user.support?
"Manage all data"
elsif @user.data_coordinator?
"Manage your organisation's logs"
else
"Manage logs assigned to you"
end
end
def display_sales?
@display_sales
end
def in_crossover_period?
@in_crossover_period
end
def subheading_for_current_year
subheading_from_year @current_year
end
def subheading_for_last_year
subheading = subheading_from_year @last_year
in_crossover_period? ? subheading : "#{subheading} (Closed collection year)"
end
def display_schemes?
!@user.data_provider?
end
private
def subheading_from_year(year)
"#{year} to #{year + 1} Logs"
end
def data_box_data(type, year, status)
{
count: logs_count(type:, year:, status:),
text: data_box_text(type:, status:),
path: logs_link(type:, year:, status:),
}
end
def data_box_text(type:, status:)
text = [status, type]
text.reverse! if status == :in_progress
text.join(" ").humanize
end
def logs_link(type:, year:, status:)
params = {
status: [status],
years: [year],
assigned_to: @user.data_provider? ? "you" : "all",
owning_organisation_select: "all",
managing_organisation_select: "all",
}
case type
when :lettings then lettings_logs_path(params)
when :sales then sales_logs_path(params)
end
end
def logs_count(type:, year:, status:)
query = case type
when :lettings then @user.lettings_logs
when :sales then @user.sales_logs
end
query = query.where(assigned_to: @user) if @user.data_provider?
query.filter_by_year(year)
.where(status:)
.count
end
def should_display_sales?
@user.support? || @user.organisation.sales_logs.exists?
end
end

3
app/views/home/_blue_box_link.html.erb

@ -0,0 +1,3 @@
<div class="app-data-box__lower">
<%= govuk_link_to text, path, class: "govuk-link--inverse" %>
</div>

7
app/views/home/_data_box.html.erb

@ -1,9 +1,6 @@
<div class="app-data-box__upper">
<div class="app-data-box__count">
<%= govuk_link_to data_count(@current_user, type), data_path(@current_user, type), class: "govuk-link--no-visited-state govuk-link--no-underline" %>
<%= govuk_link_to data_box[:count], data_box[:path], class: "govuk-link--no-visited-state govuk-link--no-underline" %>
</div>
<%= govuk_link_to data_subheading(@current_user, type), data_path(@current_user, type), class: "govuk-link--no-visited-state" %>
</div>
<div class="app-data-box__lower">
<%= govuk_link_to view_all_text(type), view_all_path(type), class: "govuk-link--inverse" %>
<%= govuk_link_to data_box[:text], data_box[:path], class: "govuk-link--no-visited-state" %>
</div>

8
app/views/home/_data_box_row_of_two.html.erb

@ -0,0 +1,8 @@
<div class="app-data-box-one-half">
<%= render partial: "home/data_box", object: left_data_box %>
</div>
<% if right_data_box %>
<div class="app-data-box-one-half">
<%= render partial: "home/data_box", object: right_data_box %>
</div>
<% end %>

8
app/views/home/_data_box_two_by_two.html.erb

@ -0,0 +1,8 @@
<div class="app-data-box-one-half">
<%= render partial: "home/data_box", object: top_left_data_box %>
<%= render partial: "home/data_box", object: bottom_left_data_box %>
</div>
<div class="app-data-box-one-half">
<%= render partial: "home/data_box", object: top_right_data_box %>
<%= render partial: "home/data_box", object: bottom_right_data_box %>
</div>

108
app/views/home/index.html.erb

@ -1,46 +1,88 @@
<div class="govuk-grid-row">
<div class="govuk-width-container">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-grid-row govuk-!-margin-bottom-7">
<div class="govuk-grid-row govuk-!-margin-bottom-6">
<span class="govuk-body-l"><%= "Welcome back, #{@current_user.name}" %></span>
<h1 class="govuk-heading-l"><%= heading_for_user_role(@current_user) %></h1>
<h1 class="govuk-heading-l"><%= @homepage_presenter.title_text_for_user %></h1>
</div>
<div class="govuk-grid-row">
<div class="app-data-box-group">
<% if @current_user.support? || (@current_user.data_coordinator? && @current_user.sales_logs.present?) %>
<div class="app-data-box-group-one-third">
<div class="app-data-box-one-third">
<span><%= render partial: "home/data_box", locals: { type: "lettings" } %></span>
</div>
<div class="app-data-box-one-third">
<span><%= render partial: "home/data_box", locals: { type: "sales" } %></span>
</div>
<div class="app-data-box-one-third">
<span><%= render partial: "home/data_box", locals: { type: "schemes" } %></span>
</div>
</div>
<% else %>
<div class="app-data-box-group-one-half">
<div class="app-data-box-one-half">
<span><%= render partial: "home/data_box", locals: { type: "lettings" } %></span>
</div>
<% if @current_user.data_coordinator? %>
<div class="app-data-box-one-half">
<span><%= render partial: "home/data_box", locals: { type: "schemes" } %></span>
</div>
<% elsif @current_user.sales_logs.present? %>
<div class="app-data-box-one-half">
<span><%= render partial: "home/data_box", locals: { type: "sales" } %></span>
</div>
<div class="app-data-box-section govuk-grid-row">
<% if @homepage_presenter.in_crossover_period? %>
<div class="app-data-box-group">
<h2 class="govuk-heading-m govuk-!-margin-bottom-2"><%= @homepage_presenter.subheading_for_last_year %></h2>
<div class="app-data-box-group-row">
<% if @homepage_presenter.display_sales? %>
<%= render partial: "home/data_box_two_by_two", locals: {
top_left_data_box: @homepage_presenter.last_year_in_progress_lettings_data,
bottom_left_data_box: @homepage_presenter.last_year_completed_lettings_data,
top_right_data_box: @homepage_presenter.last_year_in_progress_sales_data,
bottom_right_data_box: @homepage_presenter.last_year_completed_sales_data,
} %>
<% else %>
<div class="app-data-box-one-half">
<span><%= render partial: "home/data_box", locals: { type: "misc" } %></span>
</div>
<%= render partial: "home/data_box_row_of_two", locals: {
left_data_box: @homepage_presenter.last_year_in_progress_lettings_data,
right_data_box: @homepage_presenter.last_year_completed_lettings_data,
} %>
<% end %>
</div>
</div>
<% end %>
<div class="app-data-box-group">
<h2 class="govuk-heading-m govuk-!-margin-bottom-2"><%= @homepage_presenter.subheading_for_current_year %></h2>
<div class="app-data-box-group-row">
<% if @homepage_presenter.display_sales? %>
<%= render partial: "home/data_box_two_by_two", locals: {
top_left_data_box: @homepage_presenter.current_year_in_progress_lettings_data,
bottom_left_data_box: @homepage_presenter.current_year_completed_lettings_data,
top_right_data_box: @homepage_presenter.current_year_in_progress_sales_data,
bottom_right_data_box: @homepage_presenter.current_year_completed_sales_data,
} %>
<% else %>
<%= render partial: "home/data_box_row_of_two", locals: {
left_data_box: @homepage_presenter.current_year_in_progress_lettings_data,
right_data_box: @homepage_presenter.current_year_completed_lettings_data,
} %>
<% end %>
</div>
</div>
<% if !@homepage_presenter.in_crossover_period? %>
<div class="app-data-box-group">
<h2 class="govuk-heading-m govuk-!-margin-bottom-2"><%= @homepage_presenter.subheading_for_last_year %></h2>
<div class="app-data-box-group-row">
<%= render partial: "home/data_box_row_of_two", locals: {
left_data_box: @homepage_presenter.last_year_completed_lettings_data,
right_data_box: @homepage_presenter.last_year_completed_sales_data,
} %>
</div>
</div>
<% end %>
<div class="app-data-box-group-row">
<div class="app-data-box-one-half">
<%= render partial: "home/blue_box_link", locals: { text: "View all lettings", path: clear_filters_path(filter_type: "lettings_logs") } %>
</div>
<% if @homepage_presenter.display_sales? %>
<div class="app-data-box-one-half">
<%= render partial: "home/blue_box_link", locals: { text: "View all sales", path: clear_filters_path(filter_type: "sales_logs") } %>
</div>
<% end %>
</div>
</div>
<% if @homepage_presenter.display_schemes? %>
<div class="app-data-box-group">
<h2 class="govuk-heading-m govuk-!-margin-bottom-2">Schemes</h2>
<div class="app-data-box-group-row">
<div class="app-data-box-one-half">
<%= render partial: "home/data_box", object: @homepage_presenter.incomplete_schemes_data %>
<%= render partial: "home/blue_box_link", locals: { text: "View all schemes", path: clear_filters_path(filter_type: "schemes") } %>
</div>
</div>
</div>
<% end %>
<div class="govuk-grid-row">
<div class="app-data-box__underline">
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8">

6
db/schema.rb

@ -270,6 +270,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_102550) do
t.integer "irproduct"
t.string "old_id"
t.integer "joint"
t.bigint "assigned_to_id"
t.integer "retirement_value_check"
t.integer "tshortfall_known"
t.integer "sheltered"
@ -319,7 +320,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_102550) do
t.string "la_as_entered"
t.integer "partner_under_16_value_check"
t.integer "multiple_partners_value_check"
t.bigint "assigned_to_id"
t.bigint "created_by_id"
t.index ["assigned_to_id"], name: "index_lettings_logs_on_assigned_to_id"
t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id"
@ -497,6 +497,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_102550) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "owning_organisation_id"
t.bigint "assigned_to_id"
t.string "purchid"
t.integer "type"
t.integer "ownershipsch"
@ -687,7 +688,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_102550) do
t.string "la_as_entered"
t.integer "partner_under_16_value_check"
t.integer "multiple_partners_value_check"
t.bigint "assigned_to_id"
t.bigint "created_by_id"
t.index ["assigned_to_id"], name: "index_sales_logs_on_assigned_to_id"
t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id"
@ -767,8 +767,8 @@ ActiveRecord::Schema[7.0].define(version: 2024_04_08_102550) do
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.boolean "initial_confirmation_sent"
t.datetime "discarded_at"
t.boolean "reactivate_with_organisation"
t.datetime "discarded_at"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["encrypted_otp_secret_key"], name: "index_users_on_encrypted_otp_secret_key", unique: true

16
spec/factories/lettings_log.rb

@ -87,7 +87,7 @@ FactoryBot.define do
rsnvac { 6 }
unittype_gn { 7 }
beds { 3 }
voiddate { 2.days.ago }
voiddate { startdate - 2.days }
offered { 2 }
wchair { 1 }
earnings { 268 }
@ -102,7 +102,7 @@ FactoryBot.define do
layear { 2 }
waityear { 7 }
postcode_known { 1 }
postcode_full { Faker::Address.postcode }
postcode_full { "SW1A 1AA" }
reasonpref { 1 }
cbl { 0 }
chr { 1 }
@ -154,7 +154,7 @@ FactoryBot.define do
hbrentshortfall { 1 }
tshortfall { 12 }
property_relet { 0 }
mrcdate { 1.day.ago }
mrcdate { startdate - 1.day }
incref { 0 }
armedforces { 1 }
builtype { 1 }
@ -166,11 +166,19 @@ FactoryBot.define do
referral { 2 }
uprn_known { 0 }
joint { 3 }
address_line1 { "fake address" }
address_line1 { "Address line 1" }
town_or_city { "London" }
ppcodenk { 1 }
tshortfall_known { 1 }
end
trait :completed2024 do
completed
address_line1_input { address_line1 }
postcode_full_input { postcode_full }
nationality_all_group { 826 }
uprn { 1 }
uprn_selection { 1 }
end
trait :export do
tenancycode { "987654" }
ppostcode_full { "LE5 1QP" }

9
spec/factories/sales_log.rb

@ -154,6 +154,15 @@ FactoryBot.define do
buy2living { 3 }
proplen_asked { 1 }
end
trait :completed2024 do
completed
address_line1_input { address_line1 }
postcode_full_input { postcode_full }
nationality_all_group { 826 }
nationality_all_buyer2_group { 826 }
uprn { 1 }
uprn_selection { 1 }
end
trait :with_uprn do
uprn { rand(999_999_999_999).to_s }
uprn_known { 1 }

5
spec/factories/user.rb

@ -1,11 +1,14 @@
FactoryBot.define do
factory :user do
sequence(:email) { |i| "test#{i}@example.com" }
sequence(:email) { "test#{SecureRandom.hex}@example.com" }
name { "Danny Rojas" }
password { "pAssword1" }
organisation
role { "data_provider" }
phone { "1234512345123" }
trait :data_provider do
role { "data_provider" }
end
trait :data_coordinator do
role { "data_coordinator" }
end

2
spec/features/form/tasklist_page_spec.rb

@ -67,7 +67,7 @@ RSpec.describe "Task List" do
expect(page).to have_content("This log has not been started.")
end
context "when testing completed subsection count" do
describe "completed subsection count" do
let(:real_2021_2022_form) { Form.new("config/forms/2021_2022.json") }
before do

332
spec/features/home_page_spec.rb

@ -1,332 +0,0 @@
require "rails_helper"
require_relative "form/helpers"
RSpec.describe "Home Page Features" do
include Helpers
context "when there are notifications" do
let!(:user) { FactoryBot.create(:user) }
context "when the notifications are currently active" do
before do
create(:notification, title: "Notification title 1")
create(:notification, title: "Notification title 2")
create(:notification, title: "Notification title 3")
sign_in user
visit(root_path)
end
it "shows the latest notification with count and dismiss link" do
expect(page).to have_content("Notification 1 of 3")
expect(page).to have_content("Notification title 3")
expect(page).to have_link("Dismiss")
expect(page).to have_link("Link text")
end
context "when the user clicks a notification link" do
before do
click_link("Link text")
end
it "takes them to the notification details page" do
expect(page).to have_current_path(notifications_path)
expect(page).to have_content("Notification title 3")
expect(page).to have_content("Some html content")
expect(page).to have_link("Back to Home")
end
context "when they return" do
before do
click_link("Back to Home")
end
it "the notification has not been dismissed" do
expect(page).to have_current_path(root_path)
expect(page).to have_content("Notification 1 of 3")
expect(page).to have_content("Notification title 3")
expect(page).to have_link("Dismiss")
expect(page).to have_link("Link text")
end
end
end
context "when the user clicks a dismiss link" do
before do
click_link("Dismiss")
end
it "dismisses the notification and takes them back" do
expect(page).to have_current_path(root_path)
expect(page).to have_content("Notification 1 of 2")
expect(page).to have_content("Notification title 2")
expect(page).to have_link("Dismiss")
expect(page).to have_link("Link text")
end
context "when the user dismisses the penultimate notification" do
before do
click_link("Dismiss")
end
it "no longer displays the count" do
expect(page).to have_current_path(root_path)
expect(page).not_to have_content("Notification 1 of")
expect(page).to have_content("Notification title 1")
end
context "when the user dismisses the final notification" do
before do
click_link("Dismiss")
end
it "no longer displays any notification" do
expect(page).to have_current_path(root_path)
expect(page).not_to have_content("Notification")
expect(page).not_to have_link("Dismiss")
expect(page).not_to have_link("Link_text")
end
end
end
end
context "when another user has dismissed all their notifications" do
before do
other_user = create(:user)
Notification.mark_as_read! :all, for: other_user
visit(root_path)
end
it "the first user can still see the notifications" do
expect(page).to have_content("Notification 1 of 3")
expect(page).to have_content("Notification title 3")
expect(page).to have_link("Dismiss")
expect(page).to have_link("Link text")
end
end
end
context "when the notifications are not currently active" do
before do
create(:notification, end_date: Time.zone.yesterday, title: "Notification title 1")
create(:notification, start_date: Time.zone.tomorrow, title: "Notification title 2")
sign_in user
visit(root_path)
end
it "does not show any notifications" do
expect(page).not_to have_content("Notification title")
expect(page).not_to have_content("Notification 1 of")
expect(page).not_to have_link("Dismiss")
expect(page).not_to have_link("Link text")
end
end
end
context "when the user is a data provider" do
let(:user) { FactoryBot.create(:user, name: "Provider") }
before do
Timecop.freeze(Time.zone.local(2024, 1, 1))
Singleton.__init__(FormHandler)
create_list(:lettings_log, 6, :in_progress, owning_organisation: user.organisation, assigned_to: user)
create_list(:lettings_log, 2, :in_progress, owning_organisation: user.organisation)
create_list(:lettings_log, 4, :completed, owning_organisation: user.organisation, assigned_to: user)
create_list(:lettings_log, 2, :completed)
create_list(:lettings_log, 2, :not_started)
sign_in user
visit(root_path)
end
after do
Timecop.return
Singleton.__init__(FormHandler)
end
it "displays the correct welcome text" do
expect(page).to have_current_path("/")
expect(page).to have_content("Welcome back, Provider")
expect(page).to have_content("Complete your logs")
end
context "when their organisation has submitted sales logs" do
before do
create_list(:sales_log, 5, :in_progress, owning_organisation: user.organisation, assigned_to: user)
create_list(:sales_log, 3, :completed, owning_organisation: user.organisation, assigned_to: user)
create_list(:sales_log, 2, :not_started)
visit(root_path)
end
context "and it is not a crossover" do
before do
closed_period_in_progress_log = build(:lettings_log, :in_progress, owning_organisation: user.organisation, assigned_to: user, startdate: Time.zone.local(2022, 4, 1))
closed_period_in_progress_log.save!(validate: false)
visit(root_path)
end
it "displays correct data boxes, counts and links" do
data_boxes = page.find_all(class: "app-data-box-one-half")
expect(data_boxes.count).to eq(2)
expect(data_boxes[0].all("a").map(&:text)).to eq(["6", "Your lettings in progress", "View all lettings"])
expect(data_boxes[0].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "lettings_logs")])
expect(data_boxes[1].all("a").map(&:text)).to eq(["5", "Your sales in progress", "View all sales"])
expect(data_boxes[1].all("a").map { |line| line["href"] }).to eq([sales_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), sales_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "sales_logs")])
end
end
context "and it is a crossover" do
before do
Timecop.freeze(Time.zone.local(2024, 4, 1))
Singleton.__init__(FormHandler)
closed_period_in_progress_log = build(:lettings_log, :in_progress, owning_organisation: user.organisation, assigned_to: user, startdate: Time.zone.local(2022, 4, 1))
closed_period_in_progress_log.save!(validate: false)
sign_in user
visit(root_path)
end
it "displays correct data boxes, counts and links" do
data_boxes = page.find_all(class: "app-data-box-one-half")
expect(data_boxes.count).to eq(2)
expect(data_boxes[0].all("a").map(&:text)).to eq(["6", "Your lettings in progress", "View all lettings"])
expect(data_boxes[0].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2024 2023], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2024 2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "lettings_logs")])
expect(data_boxes[1].all("a").map(&:text)).to eq(["5", "Your sales in progress", "View all sales"])
expect(data_boxes[1].all("a").map { |line| line["href"] }).to eq([sales_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2024 2023], owning_organisation_select: "all", managing_organisation_select: "all"), sales_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2024 2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "sales_logs")])
end
end
end
context "when their organisation has never submitted sales logs" do
before do
visit(root_path)
end
it "displays correct data boxes, counts and links" do
data_boxes = page.find_all(class: "app-data-box-one-half")
expect(data_boxes.count).to eq(2)
expect(data_boxes[0].all("a").map(&:text)).to eq(["6", "Your lettings in progress", "View all lettings"])
expect(data_boxes[0].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: %i[in_progress], assigned_to: "you", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "lettings_logs")])
expect(data_boxes[1].all("a").map(&:text)).to eq(["4", "Your completed lettings", "View all schemes"])
expect(data_boxes[1].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: [:completed], assigned_to: "you", years: [""], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: [:completed], assigned_to: "you", years: [""], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "schemes")])
end
end
end
context "when the user is a data coordinator" do
before do
Timecop.freeze(Time.zone.local(2024, 3, 1))
Singleton.__init__(FormHandler)
create_list(:lettings_log, 6, :in_progress, owning_organisation: user.organisation)
create_list(:lettings_log, 2, :in_progress, owning_organisation: user.organisation, assigned_to: user)
create_list(:lettings_log, 4, :completed, owning_organisation: user.organisation)
create_list(:lettings_log, 2, :completed)
create_list(:lettings_log, 2, :not_started)
create_list(:scheme, 1, :incomplete, owning_organisation: user.organisation)
sign_in user
visit(root_path)
end
after do
Timecop.return
Singleton.__init__(FormHandler)
end
let(:user) { FactoryBot.create(:user, :data_coordinator, name: "Coordinator") }
it "displays the correct welcome text" do
expect(page).to have_current_path("/")
expect(page).to have_content("Welcome back, Coordinator")
expect(page).to have_content("Manage your data")
end
context "when their organisation has submitted sales logs" do
before do
create_list(:sales_log, 5, :in_progress, owning_organisation: user.organisation)
create_list(:sales_log, 3, :completed, owning_organisation: user.organisation)
create_list(:sales_log, 2, :not_started)
visit(root_path)
end
it "displays correct data boxes, counts and links" do
data_boxes = page.find_all(class: "app-data-box-one-third")
expect(data_boxes.count).to eq(3)
expect(data_boxes[0].all("a").map(&:text)).to eq(["8", "Lettings in progress", "View all lettings"])
expect(data_boxes[0].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "lettings_logs")])
expect(data_boxes[1].all("a").map(&:text)).to eq(["5", "Sales in progress", "View all sales"])
expect(data_boxes[1].all("a").map { |line| line["href"] }).to eq([sales_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), sales_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "sales_logs")])
expect(data_boxes[2].all("a").map(&:text)).to eq(["1", "Incomplete schemes", "View all schemes"])
expect(data_boxes[2].all("a").map { |line| line["href"] }).to eq([schemes_path(status: [:incomplete], owning_organisation_select: "all"), schemes_path(status: [:incomplete], owning_organisation_select: "all"), clear_filters_path(filter_type: "schemes")])
end
end
context "when their organisation has never submitted sales logs" do
before do
visit(root_path)
end
it "displays correct data boxes, counts and links" do
data_boxes = page.find_all(class: "app-data-box-one-half")
expect(data_boxes.count).to eq(2)
expect(data_boxes[0].all("a").map(&:text)).to eq(["8", "Lettings in progress", "View all lettings"])
expect(data_boxes[0].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "lettings_logs")])
expect(data_boxes[1].all("a").map(&:text)).to eq(["1", "Incomplete schemes", "View all schemes"])
expect(data_boxes[1].all("a").map { |line| line["href"] }).to eq([schemes_path(status: [:incomplete], owning_organisation_select: "all"), schemes_path(status: [:incomplete], owning_organisation_select: "all"), clear_filters_path(filter_type: "schemes")])
end
end
end
context "when the user is a support user" do
let(:support_user) { FactoryBot.create(:user, :support, name: "Support") }
let(:notify_client) { instance_double(Notifications::Client) }
let(:confirmation_token) { "MCDH5y6Km-U7CFPgAMVS" }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }
let(:otp) { "999111" }
before do
Timecop.freeze(Time.zone.local(2024, 3, 1))
Singleton.__init__(FormHandler)
create_list(:lettings_log, 2, :in_progress)
create_list(:lettings_log, 1, :completed)
create_list(:lettings_log, 2, :not_started)
create_list(:sales_log, 3, :in_progress)
create_list(:sales_log, 1, :completed)
create_list(:sales_log, 2, :not_started)
create_list(:scheme, 1, :incomplete)
completed_scheme = create(:scheme)
create(:location, scheme: completed_scheme)
allow(DeviseNotifyMailer).to receive(:new).and_return(devise_notify_mailer)
allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client)
allow(Devise).to receive(:friendly_token).and_return(confirmation_token)
allow(notify_client).to receive(:send_email).and_return(true)
allow(SecureRandom).to receive(:random_number).and_return(otp)
visit("/lettings-logs")
fill_in("user[email]", with: support_user.email)
fill_in("user[password]", with: support_user.password)
click_button("Sign in")
fill_in("code", with: otp)
click_button("Submit")
visit(root_path)
end
after do
Timecop.return
Singleton.__init__(FormHandler)
end
it "displays the correct welcome text" do
expect(page).to have_current_path("/")
expect(page).to have_content("Welcome back, Support")
expect(page).to have_content("Manage all data")
end
it "displays correct data boxes, counts and links" do
data_boxes = page.find_all(class: "app-data-box-one-third")
expect(data_boxes.count).to eq(3)
expect(data_boxes[0].all("a").map(&:text)).to eq(["2", "Lettings in progress", "View all lettings"])
expect(data_boxes[0].all("a").map { |line| line["href"] }).to eq([lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), lettings_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "lettings_logs")])
expect(data_boxes[1].all("a").map(&:text)).to eq(["3", "Sales in progress", "View all sales"])
expect(data_boxes[1].all("a").map { |line| line["href"] }).to eq([sales_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), sales_logs_path(status: %i[in_progress], assigned_to: "all", years: %w[2023], owning_organisation_select: "all", managing_organisation_select: "all"), clear_filters_path(filter_type: "sales_logs")])
expect(data_boxes[2].all("a").map(&:text)).to eq(["1", "Incomplete schemes", "View all schemes"])
expect(data_boxes[2].all("a").map { |line| line["href"] }).to eq([schemes_path(status: [:incomplete], owning_organisation_select: "all"), schemes_path(status: [:incomplete], owning_organisation_select: "all"), clear_filters_path(filter_type: "schemes")])
end
end
end

2
spec/fixtures/exports/general_needs_log.csv vendored

@ -1,2 +1,2 @@
status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,formid,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate
2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,4,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,3,,4,2,638,,0,,fake address,,London,,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00
2,BZ737,35,F,2,13,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,4,1,1,2,1,5,4,SE2 6RT,6,7,3,2,1,68,1,1,2,2,7,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,3,,4,2,638,,0,,Address line 1,,London,,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-05-01T00:00:00+01:00,2022-05-01T00:00:00+01:00

1 status tenancycode age1 sex1 ethnic national prevten ecstat1 hhmemb age2 sex2 ecstat2 age3 sex3 ecstat3 age4 sex4 ecstat4 age5 sex5 ecstat5 age6 sex6 ecstat6 age7 sex7 ecstat7 age8 sex8 ecstat8 homeless underoccupation_benefitcap leftreg reservist illness preg_occ startertenancy tenancylength tenancy ppostcode_full rsnvac unittype_gn beds offered wchair earnings incfreq benefits period layear waityear postcode_full reasonpref cbl chr cap reasonother housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h illness_type_1 illness_type_2 illness_type_3 illness_type_4 illness_type_8 illness_type_5 illness_type_6 illness_type_7 illness_type_9 illness_type_10 rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow tenancyother irproduct_other reason propcode la prevloc hb hbrentshortfall mrcdate incref startdate armedforces unitletas builtype voiddate renttype needstype lettype totchild totelder totadult nocharge referral brent scharge pscharge supcharg tcharge tshortfall chcharge ppcodenk has_benefits renewal wrent wscharge wpschrge wsupchrg wtcharge wtshortfall refused housingneeds wchchrg newprop relat2 relat3 relat4 relat5 relat6 relat7 relat8 lar irproduct joint sheltered hhtype new_old vacdays uprn uprn_known uprn_confirmed address_line1 address_line2 town_or_city county formid owningorgid owningorgname hcnum maningorgid maningorgname manhcnum createddate uploaddate
2 2 BZ737 35 F 2 13 6 0 2 32 M 6 1 4 4 1 1 2 1 5 4 SE2 6RT 6 7 3 2 1 68 1 1 2 2 7 NW1 5TY 1 2 1 2 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 4 123 E09000003 E07000105 6 1 2020-05-05T10:36:49+01:00 0 2022-02-02T10:36:49+00:00 1 2 1 2019-11-03T00:00:00+00:00 2 1 7 0 0 2 0 2 200.0 50.0 40.0 35.0 325.0 12.0 1 1 0 100.0 25.0 20.0 17.5 162.5 6.0 0 1 2 P 3 4 2 638 0 fake address Address line 1 London {id} {owning_org_id} DLUHC 1234 {managing_org_id} DLUHC 1234 2022-05-01T00:00:00+01:00 2022-05-01T00:00:00+01:00

2
spec/fixtures/exports/general_needs_log.xml vendored

@ -138,7 +138,7 @@
<uprn/>
<uprn_known>0</uprn_known>
<uprn_confirmed/>
<address_line1>fake address</address_line1>
<address_line1>Address line 1</address_line1>
<address_line2/>
<town_or_city>London</town_or_city>
<county/>

2
spec/fixtures/exports/general_needs_log_24_25.xml vendored

@ -140,7 +140,7 @@
<uprn/>
<uprn_known>0</uprn_known>
<uprn_confirmed/>
<address_line1>fake address</address_line1>
<address_line1>Address line 1</address_line1>
<address_line2/>
<town_or_city>London</town_or_city>
<county/>

2
spec/fixtures/files/lettings_log_csv_export_codes_23.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,0,,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-11-24,,,1,2023-11-25,,3,1,4,,2,,1,4,,1,4,0,0,2,35,,F,0,2,13,0,0,P,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,,
,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,,,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,0,,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,2,6,2,2,7,1,1,3,2023-11-24,,,1,2023-11-25,,3,1,4,,2,,1,4,,1,4,0,0,2,35,,F,0,2,13,0,0,P,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id created_by assigned_to is_dpo created_at updated_by updated_at creation_method old_id old_form_id collection_start_year owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode uprn_known uprn uprn_confirmed address_line1 address_line2 town_or_city county postcode_full is_la_inferred la_label la first_time_property_let_as_social_housing unitletas rsnvac newprop offered unittype_gn builtype wchair beds voiddate vacdays void_date_value_check majorrepairs mrcdate major_repairs_date_value_check joint startertenancy tenancy tenancyother tenancylength sheltered declaration hhmemb pregnancy_value_check refused hhtype totchild totelder totadult age1 retirement_value_check sex1 ethnic_group ethnic national ecstat1 details_known_2 relat2 age2 sex2 ecstat2 details_known_3 relat3 age3 sex3 ecstat3 details_known_4 relat4 age4 sex4 ecstat4 details_known_5 relat5 age5 sex5 ecstat5 details_known_6 relat6 age6 sex6 ecstat6 details_known_7 relat7 age7 sex7 ecstat7 details_known_8 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full previous_la_known is_previous_la_inferred prevloc_label prevloc reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr letting_allocation_none referral referral_value_check net_income_known incref incfreq earnings net_income_value_check hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg carehome_charges_value_check brent wrent rent_value_check scharge wscharge pscharge wpschrge supcharg wsupchrg tcharge wtcharge scharge_value_check pscharge_value_check supcharg_value_check hbrentshortfall tshortfall_known tshortfall wtshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 completed s.port@jeemayle.com s.port@jeemayle.com false 2023-11-26T00:00:00+00:00 2023-11-26T00:00:00+00:00 1 2023 DLUHC DLUHC 1 7 0 2023-11-26 2 2 1 2 HIJKLMN ABCDEFG 0 fake address Address line 1 London NW9 5LL false Barnet E09000003 0 2 6 2 2 7 1 1 3 2023-11-24 1 2023-11-25 3 1 4 2 1 4 1 4 0 0 2 35 F 0 2 13 0 0 P 32 M 6 1 R -9 R 10 0 R -9 R 10 1 4 1 2 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 7 4 6 1 0 TN23 6LZ 1 false Ashford E07000105 1 0 1 0 0 0 0 0 1 2 0 0 1 268 6 1 1 0 2 200.0 100.0 50.0 25.0 40.0 20.0 35.0 17.5 325.0 162.5 1 0 12.0 6.0

2
spec/fixtures/files/lettings_log_csv_export_codes_24.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,nationality_all,ecstat1,details_known_2,relat2,partner_under_16_value_check,multiple_partners_value_check,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2024-04-01T00:00:00+01:00,1,2023,,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,1,,fake address,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,0,2,6,2,7,1,1,3,2023-11-24,,,1,2023-11-25,,3,1,4,,2,,4,,1,4,0,0,2,35,,F,0,2,,0,0,P,,,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,,
,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2024-04-01T00:00:00+01:00,1,2023,,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,1,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,0,2,6,2,7,1,1,3,2023-11-24,,,1,2023-11-25,,3,1,4,,2,,4,,1,4,0,0,2,35,,F,0,2,,0,0,P,,,32,M,6,1,R,-9,R,10,0,R,-9,R,10,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,,2,,0,0,1,268,,6,1,1,,0,2,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id created_by assigned_to is_dpo created_at updated_by updated_at creation_method collection_start_year bulk_upload_id owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode declaration uprn address_line1 address_line2 town_or_city county postcode_full is_la_inferred la_label la uprn_known uprn_selection address_search_value_check address_line1_input postcode_full_input address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered first_time_property_let_as_social_housing unitletas rsnvac newprop unittype_gn builtype wchair beds voiddate vacdays void_date_value_check majorrepairs mrcdate major_repairs_date_value_check joint startertenancy tenancy tenancyother tenancylength sheltered hhmemb pregnancy_value_check refused hhtype totchild totelder totadult age1 retirement_value_check sex1 ethnic_group ethnic nationality_all ecstat1 details_known_2 relat2 partner_under_16_value_check multiple_partners_value_check age2 sex2 ecstat2 details_known_3 relat3 age3 sex3 ecstat3 details_known_4 relat4 age4 sex4 ecstat4 details_known_5 relat5 age5 sex5 ecstat5 details_known_6 relat6 age6 sex6 ecstat6 details_known_7 relat7 age7 sex7 ecstat7 details_known_8 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother reasonother_value_check prevten homeless ppcodenk ppostcode_full previous_la_known is_previous_la_inferred prevloc_label prevloc reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr accessible_register letting_allocation_none referral referral_value_check net_income_known incref incfreq earnings net_income_value_check hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg carehome_charges_value_check brent wrent rent_value_check scharge wscharge pscharge wpschrge supcharg wsupchrg tcharge wtcharge scharge_value_check pscharge_value_check supcharg_value_check hbrentshortfall tshortfall_known tshortfall wtshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 completed s.port@jeemayle.com s.port@jeemayle.com false 2023-11-26T00:00:00+00:00 2024-04-01T00:00:00+01:00 1 2023 DLUHC DLUHC 1 7 0 2023-11-26 2 2 1 2 HIJKLMN ABCDEFG 1 fake address Address line 1 London NW9 5LL false Barnet E09000003 0 address line 1 as entered address line 2 as entered town or city as entered county as entered AB1 2CD la as entered 0 2 6 2 7 1 1 3 2023-11-24 1 2023-11-25 3 1 4 2 4 1 4 0 0 2 35 F 0 2 0 0 P 32 M 6 1 R -9 R 10 0 R -9 R 10 1 4 1 2 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 7 4 6 1 0 TN23 6LZ 1 false Ashford E07000105 1 0 1 0 0 0 0 0 1 0 2 0 0 1 268 6 1 1 0 2 200.0 100.0 50.0 25.0 40.0 20.0 35.0 17.5 325.0 162.5 1 0 12.0 6.0

2
spec/fixtures/files/lettings_log_csv_export_labels_23.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,old_id,old_form_id,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,uprn_confirmed,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,national,ecstat1,details_known_2,relat2,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,,,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,No,,,fake address,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,,,Yes,2023-11-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,,Yes,4,0,0,2,35,,Female,White,Irish,Tenant prefers not to say,Other,Yes,Partner,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,,
,completed,,s.port@jeemayle.com,s.port@jeemayle.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,,,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,No,,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,,,Yes,2023-11-25,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,,Yes,4,0,0,2,35,,Female,White,Irish,Tenant prefers not to say,Other,Yes,Partner,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id created_by assigned_to is_dpo created_at updated_by updated_at creation_method old_id old_form_id collection_start_year owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode uprn_known uprn uprn_confirmed address_line1 address_line2 town_or_city county postcode_full is_la_inferred la_label la first_time_property_let_as_social_housing unitletas rsnvac newprop offered unittype_gn builtype wchair beds voiddate vacdays void_date_value_check majorrepairs mrcdate major_repairs_date_value_check joint startertenancy tenancy tenancyother tenancylength sheltered declaration hhmemb pregnancy_value_check refused hhtype totchild totelder totadult age1 retirement_value_check sex1 ethnic_group ethnic national ecstat1 details_known_2 relat2 age2 sex2 ecstat2 details_known_3 relat3 age3 sex3 ecstat3 details_known_4 relat4 age4 sex4 ecstat4 details_known_5 relat5 age5 sex5 ecstat5 details_known_6 relat6 age6 sex6 ecstat6 details_known_7 relat7 age7 sex7 ecstat7 details_known_8 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full previous_la_known is_previous_la_inferred prevloc_label prevloc reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr letting_allocation_none referral referral_value_check net_income_known incref incfreq earnings net_income_value_check hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg carehome_charges_value_check brent wrent rent_value_check scharge wscharge pscharge wpschrge supcharg wsupchrg tcharge wtcharge scharge_value_check pscharge_value_check supcharg_value_check hbrentshortfall tshortfall_known tshortfall wtshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 completed s.port@jeemayle.com s.port@jeemayle.com false 2023-11-26T00:00:00+00:00 2023-11-26T00:00:00+00:00 single log 2023 DLUHC DLUHC General needs Affordable rent general needs local authority No 2023-11-26 Affordable Rent Affordable Rent Rent to Buy No HIJKLMN ABCDEFG No fake address Address line 1 London NW9 5LL No Barnet E09000003 No Affordable rent basis Tenant abandoned property No 2 House Purpose built Yes 3 2023-11-24 Yes 2023-11-25 Don’t know Yes Assured Shorthold Tenancy (AST) – Fixed term 2 Yes 4 Yes 4 0 0 2 35 Female White Irish Tenant prefers not to say Other Yes Partner 32 Male Not seeking work No Prefers not to say Not known Prefers not to say Prefers not to say Yes Person prefers not to say Not known Person prefers not to say Person prefers not to say Yes – the person is a current or former regular No – they left up to and including 5 years ago Yes No Yes Fully wheelchair accessible housing Yes No No No No No No Yes No No Yes No No No No No No No Less than 1 year 1 year but under 2 years Loss of tied accommodation Other supported housing No Yes TN23 6LZ Yes No Ashford E07000105 Yes Yes No No Yes Tenant applied directly (no referral or nomination) Yes No Weekly 268 Universal Credit housing element Yes All No Every 2 weeks 200.0 100.0 50.0 25.0 40.0 20.0 35.0 17.5 325.0 162.5 Yes Yes 12.0 6.0

2
spec/fixtures/files/lettings_log_csv_export_labels_24.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sex1,ethnic_group,ethnic,nationality_all,ecstat1,details_known_2,relat2,partner_under_16_value_check,multiple_partners_value_check,age2,sex2,ecstat2,details_known_3,relat3,age3,sex3,ecstat3,details_known_4,relat4,age4,sex4,ecstat4,details_known_5,relat5,age5,sex5,ecstat5,details_known_6,relat6,age6,sex6,ecstat6,details_known_7,relat7,age7,sex7,ecstat7,details_known_8,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,carehome_charges_value_check,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,,fake address,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,,,Yes,2024-03-31,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,,Yes,4,0,0,2,35,,Female,White,Irish,Australia,Other,Yes,Partner,,,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,,
,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,,,Yes,2024-03-31,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,,Yes,4,0,0,2,35,,Female,White,Irish,Australia,Other,Yes,Partner,,,32,Male,Not seeking work,No,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Yes,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id created_by assigned_to is_dpo created_at updated_by updated_at creation_method collection_start_year bulk_upload_id owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode declaration uprn address_line1 address_line2 town_or_city county postcode_full is_la_inferred la_label la uprn_known uprn_selection address_search_value_check address_line1_input postcode_full_input address_line1_as_entered address_line2_as_entered town_or_city_as_entered county_as_entered postcode_full_as_entered la_as_entered first_time_property_let_as_social_housing unitletas rsnvac newprop unittype_gn builtype wchair beds voiddate vacdays void_date_value_check majorrepairs mrcdate major_repairs_date_value_check joint startertenancy tenancy tenancyother tenancylength sheltered hhmemb pregnancy_value_check refused hhtype totchild totelder totadult age1 retirement_value_check sex1 ethnic_group ethnic nationality_all ecstat1 details_known_2 relat2 partner_under_16_value_check multiple_partners_value_check age2 sex2 ecstat2 details_known_3 relat3 age3 sex3 ecstat3 details_known_4 relat4 age4 sex4 ecstat4 details_known_5 relat5 age5 sex5 ecstat5 details_known_6 relat6 age6 sex6 ecstat6 details_known_7 relat7 age7 sex7 ecstat7 details_known_8 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother reasonother_value_check prevten homeless ppcodenk ppostcode_full previous_la_known is_previous_la_inferred prevloc_label prevloc reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr accessible_register letting_allocation_none referral referral_value_check net_income_known incref incfreq earnings net_income_value_check hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg carehome_charges_value_check brent wrent rent_value_check scharge wscharge pscharge wpschrge supcharg wsupchrg tcharge wtcharge scharge_value_check pscharge_value_check supcharg_value_check hbrentshortfall tshortfall_known tshortfall wtshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 in_progress s.port@jeemayle.com s.port@jeemayle.com false 2024-04-01T00:00:00+01:00 2024-04-01T00:00:00+01:00 single log 2024 DLUHC DLUHC General needs Affordable rent general needs local authority No 2024-04-01 Affordable Rent Affordable Rent No HIJKLMN ABCDEFG Yes fake address Address line 1 London NW9 5LL No Barnet E09000003 No address line 1 as entered address line 2 as entered town or city as entered county as entered AB1 2CD la as entered No Affordable rent basis Tenant abandoned property No House Purpose built Yes 3 2024-03-30 Yes 2024-03-31 Don’t know Yes Assured Shorthold Tenancy (AST) – Fixed term 2 4 Yes 4 0 0 2 35 Female White Irish Australia Other Yes Partner 32 Male Not seeking work No Prefers not to say Not known Prefers not to say Prefers not to say Yes Person prefers not to say Not known Person prefers not to say Person prefers not to say Yes – the person is a current or former regular No – they left up to and including 5 years ago Yes No Yes Fully wheelchair accessible housing Yes No No No No No No Yes No No Yes No No No No No No No Less than 1 year 1 year but under 2 years Loss of tied accommodation Other supported housing No Yes TN23 6LZ Yes No Ashford E07000105 Yes Yes No No Yes No Tenant applied directly (no referral or nomination) Yes No Weekly 268 Universal Credit housing element Yes All No Every 2 weeks 200.0 100.0 50.0 25.0 40.0 20.0 35.0 17.5 325.0 162.5 Yes Yes 12.0 6.0

2
spec/fixtures/files/lettings_log_csv_export_non_support_codes_23.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,0,,fake address,,London,,NW9 5LL,Barnet,0,2,6,2,2,7,1,1,3,2023-11-24,1,1,2023-11-25,3,1,4,,2,,1,4,1,35,F,0,2,13,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,,
,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,1,2023,DLUHC,DLUHC,1,7,0,2023-11-26,2,2,1,,2,HIJKLMN,ABCDEFG,0,,Address line 1,,London,,NW9 5LL,Barnet,0,2,6,2,2,7,1,1,3,2023-11-24,1,1,2023-11-25,3,1,4,,2,,1,4,1,35,F,0,2,13,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id assigned_to is_dpo created_at updated_by updated_at creation_method collection_start_year owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode uprn_known uprn address_line1 address_line2 town_or_city county postcode_full la_label first_time_property_let_as_social_housing unitletas rsnvac newprop offered unittype_gn builtype wchair beds voiddate vacdays majorrepairs mrcdate joint startertenancy tenancy tenancyother tenancylength sheltered declaration hhmemb refused age1 sex1 ethnic_group ethnic national ecstat1 relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 sex7 ecstat7 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full prevloc_label reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr letting_allocation_none referral incref incfreq earnings hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg brent scharge pscharge supcharg tcharge hbrentshortfall tshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 completed choreographer@owtluk.com false 2023-11-26T00:00:00+00:00 2023-11-26T00:00:00+00:00 1 2023 DLUHC DLUHC 1 7 0 2023-11-26 2 2 1 2 HIJKLMN ABCDEFG 0 fake address Address line 1 London NW9 5LL Barnet 0 2 6 2 2 7 1 1 3 2023-11-24 1 1 2023-11-25 3 1 4 2 1 4 1 35 F 0 2 13 0 P 32 M 6 R -9 R 10 R -9 R 10 1 4 1 2 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 7 4 6 1 0 TN23 6LZ Ashford 1 0 1 0 0 0 0 0 1 2 0 1 268 6 1 1 0 2 200.0 50.0 40.0 35.0 325.0 1 12.0

2
spec/fixtures/files/lettings_log_csv_export_non_support_codes_24.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,refused,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,1,2024,,DLUHC,DLUHC,1,7,0,2024-04-01,2,2,1,,2,HIJKLMN,ABCDEFG,1,0,,fake address,,London,,NW9 5LL,Barnet,0,2,6,2,7,1,1,3,2024-03-30,0,1,2024-03-31,3,1,4,,2,,4,1,35,F,0,2,,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,0,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,,
,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,1,2024,,DLUHC,DLUHC,1,7,0,2024-04-01,2,2,1,,2,HIJKLMN,ABCDEFG,1,0,,Address line 1,,London,,NW9 5LL,Barnet,0,2,6,2,7,1,1,3,2024-03-30,0,1,2024-03-31,3,1,4,,2,,4,1,35,F,0,2,,0,P,32,M,6,R,-9,R,10,R,-9,R,10,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,0,,2,0,1,268,6,1,1,,0,2,,,,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id assigned_to is_dpo created_at updated_by updated_at creation_method collection_start_year bulk_upload_id owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode declaration uprn_known uprn address_line1 address_line2 town_or_city county postcode_full la_label first_time_property_let_as_social_housing unitletas rsnvac newprop unittype_gn builtype wchair beds voiddate vacdays majorrepairs mrcdate joint startertenancy tenancy tenancyother tenancylength sheltered hhmemb refused age1 sex1 ethnic_group ethnic nationality_all ecstat1 relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 sex7 ecstat7 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full prevloc_label reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr accessible_register letting_allocation_none referral incref incfreq earnings hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg brent scharge pscharge supcharg tcharge hbrentshortfall tshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 in_progress choreographer@owtluk.com false 2024-04-01T00:00:00+01:00 2024-04-01T00:00:00+01:00 1 2024 DLUHC DLUHC 1 7 0 2024-04-01 2 2 1 2 HIJKLMN ABCDEFG 1 0 fake address Address line 1 London NW9 5LL Barnet 0 2 6 2 7 1 1 3 2024-03-30 0 1 2024-03-31 3 1 4 2 4 1 35 F 0 2 0 P 32 M 6 R -9 R 10 R -9 R 10 1 4 1 2 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 2 7 4 6 1 0 TN23 6LZ Ashford 1 0 1 0 0 0 0 0 1 0 2 0 1 268 6 1 1 0 2 200.0 50.0 40.0 35.0 325.0 1 12.0

2
spec/fixtures/files/lettings_log_csv_export_non_support_labels_23.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,offered,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,declaration,hhmemb,refused,age1,sex1,ethnic_group,ethnic,national,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,No,,fake address,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,1,Yes,2023-11-25,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,Yes,35,Female,White,Irish,Tenant prefers not to say,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,,
,completed,,choreographer@owtluk.com,false,2023-11-26T00:00:00+00:00,,2023-11-26T00:00:00+00:00,single log,2023,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2023-11-26,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,No,,Address line 1,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,2,House,Purpose built,Yes,3,2023-11-24,1,Yes,2023-11-25,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,Yes,4,Yes,35,Female,White,Irish,Tenant prefers not to say,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id assigned_to is_dpo created_at updated_by updated_at creation_method collection_start_year owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode uprn_known uprn address_line1 address_line2 town_or_city county postcode_full la_label first_time_property_let_as_social_housing unitletas rsnvac newprop offered unittype_gn builtype wchair beds voiddate vacdays majorrepairs mrcdate joint startertenancy tenancy tenancyother tenancylength sheltered declaration hhmemb refused age1 sex1 ethnic_group ethnic national ecstat1 relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 sex7 ecstat7 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full prevloc_label reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr letting_allocation_none referral incref incfreq earnings hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg brent scharge pscharge supcharg tcharge hbrentshortfall tshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 completed choreographer@owtluk.com false 2023-11-26T00:00:00+00:00 2023-11-26T00:00:00+00:00 single log 2023 DLUHC DLUHC General needs Affordable rent general needs local authority No 2023-11-26 Affordable Rent Affordable Rent Rent to Buy No HIJKLMN ABCDEFG No fake address Address line 1 London NW9 5LL Barnet No Affordable rent basis Tenant abandoned property No 2 House Purpose built Yes 3 2023-11-24 1 Yes 2023-11-25 Don’t know Yes Assured Shorthold Tenancy (AST) – Fixed term 2 Yes 4 Yes 35 Female White Irish Tenant prefers not to say Other Partner 32 Male Not seeking work Prefers not to say Not known Prefers not to say Prefers not to say Person prefers not to say Not known Person prefers not to say Person prefers not to say Yes – the person is a current or former regular No – they left up to and including 5 years ago Yes No Yes Fully wheelchair accessible housing Yes No No No No No No Yes No No Yes No No No No No No No Less than 1 year 1 year but under 2 years Loss of tied accommodation Other supported housing No Yes TN23 6LZ Ashford Yes Yes No No Yes Tenant applied directly (no referral or nomination) No Weekly 268 Universal Credit housing element Yes All No Every 2 weeks 200.0 50.0 40.0 35.0 325.0 Yes 12.0

2
spec/fixtures/files/lettings_log_csv_export_non_support_labels_24.csv vendored

@ -1,2 +1,2 @@
id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,unittype_gn,builtype,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,joint,startertenancy,tenancy,tenancyother,tenancylength,sheltered,hhmemb,refused,age1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,relat2,age2,sex2,ecstat2,relat3,age3,sex3,ecstat3,relat4,age4,sex4,ecstat4,relat5,age5,sex5,ecstat5,relat6,age6,sex6,ecstat6,relat7,age7,sex7,ecstat7,relat8,age8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,is_carehome,chcharge,wchchrg,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate
,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,Yes,No,,fake address,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,0,Yes,2024-03-31,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,Yes,35,Female,White,Irish,,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,,
,in_progress,,choreographer@owtluk.com,false,2024-04-01T00:00:00+01:00,,2024-04-01T00:00:00+01:00,single log,2024,,DLUHC,DLUHC,General needs,Affordable rent general needs local authority,No,2024-04-01,Affordable Rent,Affordable Rent,Rent to Buy,,No,HIJKLMN,ABCDEFG,Yes,No,,Address line 1,,London,,NW9 5LL,Barnet,No,Affordable rent basis,Tenant abandoned property,No,House,Purpose built,Yes,3,2024-03-30,0,Yes,2024-03-31,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,,4,Yes,35,Female,White,Irish,,Other,Partner,32,Male,Not seeking work,Prefers not to say,Not known,Prefers not to say,Prefers not to say,Person prefers not to say,Not known,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,No,,Tenant applied directly (no referral or nomination),No,Weekly,268,Universal Credit housing element,Yes,All,,No,Every 2 weeks,,,,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,,

1 id status duplicate_set_id assigned_to is_dpo created_at updated_by updated_at creation_method collection_start_year bulk_upload_id owning_organisation_name managing_organisation_name needstype lettype renewal startdate renttype renttype_detail irproduct irproduct_other lar tenancycode propcode declaration uprn_known uprn address_line1 address_line2 town_or_city county postcode_full la_label first_time_property_let_as_social_housing unitletas rsnvac newprop unittype_gn builtype wchair beds voiddate vacdays majorrepairs mrcdate joint startertenancy tenancy tenancyother tenancylength sheltered hhmemb refused age1 sex1 ethnic_group ethnic nationality_all ecstat1 relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 sex7 ecstat7 relat8 age8 sex8 ecstat8 armedforces leftreg reservist preg_occ housingneeds housingneeds_type housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h housingneeds_other illness illness_type_4 illness_type_5 illness_type_2 illness_type_6 illness_type_7 illness_type_3 illness_type_9 illness_type_8 illness_type_1 illness_type_10 layear waityear reason reasonother prevten homeless ppcodenk ppostcode_full prevloc_label reasonpref rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow cbl cap chr accessible_register letting_allocation_none referral incref incfreq earnings hb has_benefits benefits household_charge nocharge period is_carehome chcharge wchchrg brent scharge pscharge supcharg tcharge hbrentshortfall tshortfall scheme_code scheme_service_name scheme_confidential SCHTYPE scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_local_authority location_startdate
2 in_progress choreographer@owtluk.com false 2024-04-01T00:00:00+01:00 2024-04-01T00:00:00+01:00 single log 2024 DLUHC DLUHC General needs Affordable rent general needs local authority No 2024-04-01 Affordable Rent Affordable Rent Rent to Buy No HIJKLMN ABCDEFG Yes No fake address Address line 1 London NW9 5LL Barnet No Affordable rent basis Tenant abandoned property No House Purpose built Yes 3 2024-03-30 0 Yes 2024-03-31 Don’t know Yes Assured Shorthold Tenancy (AST) – Fixed term 2 4 Yes 35 Female White Irish Other Partner 32 Male Not seeking work Prefers not to say Not known Prefers not to say Prefers not to say Person prefers not to say Not known Person prefers not to say Person prefers not to say Yes – the person is a current or former regular No – they left up to and including 5 years ago Yes No Yes Fully wheelchair accessible housing Yes No No No No No No Yes No No Yes No No No No No No No Less than 1 year 1 year but under 2 years Loss of tied accommodation Other supported housing No Yes TN23 6LZ Ashford Yes Yes No No Yes No Tenant applied directly (no referral or nomination) No Weekly 268 Universal Credit housing element Yes All No Every 2 weeks 200.0 50.0 40.0 35.0 325.0 Yes 12.0

28
spec/models/lettings_log_spec.rb

@ -2762,6 +2762,7 @@ RSpec.describe LettingsLog do
describe "scopes" do
let!(:lettings_log_1) { create(:lettings_log, :in_progress, startdate: Time.utc(2021, 5, 3), mrcdate: Time.utc(2021, 5, 3), voiddate: Time.utc(2021, 5, 3), assigned_to: assigned_to_user) }
let!(:lettings_log_2) { create(:lettings_log, :completed, startdate: Time.utc(2021, 5, 3), mrcdate: Time.utc(2021, 5, 3), voiddate: Time.utc(2021, 5, 3), assigned_to: assigned_to_user) }
let(:postcode_to_search) { "SW1A 0AA" }
before do
Timecop.freeze(Time.utc(2022, 6, 3))
@ -2824,21 +2825,27 @@ RSpec.describe LettingsLog do
end
describe "#filter_by_postcode" do
it "allows searching by a Property Postcode" do
result = described_class.filter_by_postcode(lettings_log_to_search.postcode_full)
expect(result.count).to eq(1)
expect(result.first.id).to eq lettings_log_to_search.id
context "when not associated with a location" do
before do
lettings_log_to_search.update!(postcode_full: postcode_to_search)
end
it "allows searching by a Property Postcode" do
result = described_class.filter_by_postcode(postcode_to_search)
expect(result.count).to eq(1)
expect(result.first.id).to eq lettings_log_to_search.id
end
end
context "when lettings log is supported housing" do
let(:location) { create(:location, postcode: "W6 0ST") }
let(:location) { create(:location, postcode: postcode_to_search) }
before do
lettings_log_to_search.update!(needstype: 2, location:)
end
it "allows searching by a Property Postcode" do
result = described_class.filter_by_location_postcode("W6 0ST")
result = described_class.filter_by_location_postcode(postcode_to_search)
expect(result.count).to eq(1)
expect(result.first.id).to eq lettings_log_to_search.id
end
@ -2865,7 +2872,8 @@ RSpec.describe LettingsLog do
end
it "allows searching by a Property Postcode" do
result = described_class.search_by(lettings_log_to_search.postcode_full)
lettings_log_to_search.update!(postcode_full: postcode_to_search)
result = described_class.search_by(postcode_to_search)
expect(result.count).to eq(1)
expect(result.first.id).to eq lettings_log_to_search.id
end
@ -2897,10 +2905,10 @@ RSpec.describe LettingsLog do
end
context "when postcode has spaces and lower case letters" do
let(:matching_postcode_lower_case_with_spaces) { lettings_log_to_search.postcode_full.downcase.chars.insert(3, " ").join }
it "allows searching by a Property Postcode" do
result = described_class.search_by(matching_postcode_lower_case_with_spaces)
lettings_log_to_search.update!(postcode_full: postcode_to_search)
unformatted_postcode = postcode_to_search.downcase.chars.join(" ")
result = described_class.search_by(unformatted_postcode)
expect(result.count).to eq(1)
expect(result.first.id).to eq lettings_log_to_search.id
end

312
spec/presenters/homepage_presenter_spec.rb

@ -0,0 +1,312 @@
require "rails_helper"
RSpec.describe HomepagePresenter do
let(:organisation) { create(:organisation) }
let(:user) { create(:user, organisation:) }
let(:in_crossover_period) { true }
let(:presenter) { described_class.new(user) }
let(:date_this_year) { Time.zone.today }
let(:date_last_year) { Time.zone.today - 1.year }
let(:expected_count) { rand 1..10 }
before do
allow(FormHandler.instance).to receive(:in_crossover_period?).and_return(in_crossover_period)
end
context "when the user is support" do
let(:user) { create(:user, :support) }
it "sets the correct title" do
expect(presenter.title_text_for_user).to eq "Manage all data"
end
it "returns that schemes should be displayed" do
expect(presenter.display_schemes?).to be true
end
it "returns that sales logs should be displayed" do
expect(presenter.display_sales?).to be true
end
end
context "when the user is a data coordinator" do
let(:user) { create(:user, :data_coordinator) }
it "sets the correct title" do
expect(presenter.title_text_for_user).to eq "Manage your organisation's logs"
end
it "returns that schemes should be displayed" do
expect(presenter.display_schemes?).to be true
end
end
context "when the user is a data provider" do
let(:user) { create(:user, :data_provider) }
it "sets the correct title" do
expect(presenter.title_text_for_user).to eq "Manage logs assigned to you"
end
it "returns that schemes should not be displayed" do
expect(presenter.display_schemes?).to be false
end
end
context "when the user's organisation has never submitted sales logs" do
it "shows the user's organisation does not log sales" do
expect(presenter.display_sales?).to be false
end
context "when in the crossover period" do
let(:in_crossover_period) { true }
it "leaves all sales related data as nil" do
sales_data = [
presenter.current_year_in_progress_sales_data,
presenter.current_year_completed_sales_data,
presenter.last_year_in_progress_sales_data,
presenter.last_year_completed_sales_data,
]
expect(sales_data).to all be nil
end
end
context "when not in the crossover period" do
let(:in_crossover_period) { false }
it "leaves all sales related data as nil" do
sales_data = [
presenter.current_year_in_progress_sales_data,
presenter.current_year_completed_sales_data,
presenter.last_year_in_progress_sales_data,
presenter.last_year_completed_sales_data,
]
expect(sales_data).to all be nil
end
end
end
context "when the user's organisation has submitted sales logs" do
before do
create(:sales_log, assigned_to: user)
end
it "shows the user's organisation logs sales" do
expect(presenter.display_sales?).to be true
end
context "when in the crossover period" do
let(:in_crossover_period) { true }
it "populates all sales related data" do
sales_data = [
presenter.current_year_in_progress_sales_data,
presenter.current_year_completed_sales_data,
presenter.last_year_in_progress_sales_data,
presenter.last_year_completed_sales_data,
]
expect(sales_data).to all be_an_instance_of(Hash)
end
end
context "when not in the crossover period" do
let(:in_crossover_period) { false }
it "populates all relevant sales related data" do
sales_data = [
presenter.current_year_in_progress_sales_data,
presenter.current_year_completed_sales_data,
presenter.last_year_completed_sales_data,
]
expect(sales_data).to all be_an_instance_of(Hash)
end
it "does not populate data for last year's in progress logs" do
last_year_in_progress_data = [
presenter.last_year_in_progress_lettings_data,
presenter.last_year_in_progress_sales_data,
]
expect(last_year_in_progress_data).to all be nil
end
end
end
context "when in the crossover period" do
let(:in_crossover_period) { true }
it "returns that we are in the crossover period" do
expect(presenter.in_crossover_period?).to be true
end
end
context "when not in the crossover period" do
let(:in_crossover_period) { false }
it "returns that we are in the crossover period" do
expect(presenter.in_crossover_period?).to be false
end
end
describe "the data collected and exposed by the presenter" do
context "with lettings logs" do
let(:type) { :lettings_log }
context "with in progress status" do
let(:status) { :in_progress }
context "and the current year" do
let(:startdate) { date_this_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, status, assigned_to: user, startdate:)
data = presenter.current_year_in_progress_lettings_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Lettings in progress"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_this_year.year.to_s]
end
end
context "and the last year" do
let(:startdate) { date_last_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, status, assigned_to: user, startdate:)
data = presenter.last_year_in_progress_lettings_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Lettings in progress"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_last_year.year.to_s]
end
end
end
context "with completed status" do
let(:status) { :completed }
context "and the current year" do
let(:startdate) { date_this_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, :completed2024, assigned_to: user, startdate:)
data = presenter.current_year_completed_lettings_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Completed lettings"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_this_year.year.to_s]
end
end
context "and the last year" do
let(:startdate) { date_last_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, status, assigned_to: user, startdate:)
data = presenter.last_year_completed_lettings_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Completed lettings"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_last_year.year.to_s]
end
end
end
end
context "with sales logs" do
let(:type) { :sales_log }
context "with in progress status" do
let(:status) { :in_progress }
context "and the current year" do
let(:saledate) { date_this_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, status, assigned_to: user, saledate:)
data = presenter.current_year_in_progress_sales_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Sales in progress"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_this_year.year.to_s]
end
end
context "and the last year" do
let(:saledate) { date_last_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, status, assigned_to: user, saledate:)
data = presenter.last_year_in_progress_sales_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Sales in progress"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_last_year.year.to_s]
end
end
end
context "with completed status" do
let(:status) { :completed }
context "and the current year" do
let(:saledate) { date_this_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, :completed2024, assigned_to: user, saledate:)
data = presenter.current_year_completed_sales_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Completed sales"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_this_year.year.to_s]
end
end
context "and the last year" do
let(:saledate) { date_last_year }
it "exposes the correct data for the data box" do
create_list(type, expected_count, status, assigned_to: user, saledate:)
data = presenter.last_year_completed_sales_data
expect(data[:count]).to be expected_count
expect(data[:text]).to eq "Completed sales"
uri = URI.parse(data[:path])
expect(uri.path).to eq "/#{type.to_s.dasherize}s"
query_params = CGI.parse(uri.query)
expect(query_params["status[]"]).to eq [status.to_s]
expect(query_params["years[]"]).to eq [date_last_year.year.to_s]
end
end
end
end
end
end

3
spec/request_helper.rb

@ -83,6 +83,9 @@ module RequestHelper
WebMock.stub_request(:get, "https://api.os.uk/search/places/v1/uprn?key=OS_DATA_KEY&uprn=1234567890123")
.to_return(status: 404, body: "", headers: {})
WebMock.stub_request(:get, "https://api.os.uk/search/places/v1/find?key=OS_DATA_KEY&maxresults=10&minmatch=0.4&query=Address%20line%201,%20SW1A%201AA")
.to_return(status: 200, body: { results: [{ DPA: { MATCH: 0.9, BUILDING_NAME: "result address line 1", POST_TOWN: "result town or city", POSTCODE: "AA1 1AA", UPRN: "1" } }] }.to_json, headers: {})
end
def self.real_http_requests

307
spec/requests/start_controller_spec.rb

@ -2,7 +2,6 @@ require "rails_helper"
RSpec.describe StartController, type: :request do
let(:user) { create(:user) }
let(:headers) { { "Accept" => "text/html" } }
let(:page) { Capybara::Node::Simple.new(response.body) }
let(:notify_client) { instance_double(Notifications::Client) }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }
@ -16,7 +15,7 @@ RSpec.describe StartController, type: :request do
describe "GET" do
context "when the user is not signed in" do
it "routes user to the start page" do
get "/", headers: headers, params: {}
get root_path
expect(path).to eq("/")
expect(page).to have_content("Start now")
end
@ -24,21 +23,293 @@ RSpec.describe StartController, type: :request do
context "when the user is signed in" do
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
end
it "routes user to the home page" do
get "/", headers:, params: {}
get root_path
expect(page).to have_content("Welcome back")
end
describe "the data displayed at the top of the home page" do
let(:current_year) { FormHandler.instance.current_collection_start_year }
let(:in_crossover_period) { false }
before do
allow(FormHandler.instance).to receive(:in_crossover_period?).and_return in_crossover_period
end
context "when in the crossover period" do
let(:in_crossover_period) { true }
it "shows both open collection years with last year first" do
get root_path
logs_headers = page.find_all("h2").map(&:text).select { |header| header.include? "Logs" }
expected_headers = [
"#{current_year - 1} to #{current_year} Logs",
"#{current_year} to #{current_year + 1} Logs",
]
expect(logs_headers).to eq expected_headers
end
end
context "when not in the crossover period" do
let(:in_crossover_period) { false }
it "shows this year first, with last year's after marked as closed" do
get root_path
logs_headers = page.find_all("h2").map(&:text).select { |header| header.include? "Logs" }
expected_headers = [
"#{current_year} to #{current_year + 1} Logs",
"#{current_year - 1} to #{current_year} Logs (Closed collection year)",
]
expect(logs_headers).to eq expected_headers
end
end
context "when the user's org has never submitted sales" do
it "does not display data related to sales" do
get root_path
databox_texts = page.find_all(".app-data-box__upper").map(&:text)
any_sales_boxes = databox_texts.map(&:downcase).any? { |text| text.include? "sales" }
expect(any_sales_boxes).to be false
end
end
context "when the user's org has submitted sales logs" do
before do
create(:sales_log, assigned_to: user)
end
it "displays data related to sales" do
get root_path
databox_texts = page.find_all(".app-data-box__upper").map(&:text)
any_sales_boxes = databox_texts.map(&:downcase).any? { |text| text.include? "sales" }
expect(any_sales_boxes).to be true
end
end
context "when the user is a data provider" do
let(:user) { create(:user, :data_provider) }
it "does not display data related to schemes" do
get root_path
databox_texts = page.find_all(".app-data-box__upper").map(&:text)
any_schemes_boxes = databox_texts.map(&:downcase).any? { |text| text.include? "schemes" }
expect(any_schemes_boxes).to be false
end
end
context "when the user is a data coordinator" do
let(:user) { create(:user, :data_coordinator) }
it "does display data related to schemes" do
get root_path
databox_texts = page.find_all(".app-data-box__upper").map(&:text)
any_schemes_boxes = databox_texts.map(&:downcase).any? { |text| text.include? "schemes" }
expect(any_schemes_boxes).to be true
end
end
context "when the user is a support user" do
let(:user) { create(:user, :support) }
it "does display data related to schemes" do
get root_path
databox_texts = page.find_all(".app-data-box__upper").map(&:text)
any_schemes_boxes = databox_texts.map(&:downcase).any? { |text| text.include? "schemes" }
expect(any_schemes_boxes).to be true
end
end
describe "the links in the data boxes" do
let(:user) { create(:user, :data_coordinator) }
let(:in_crossover_period) { true }
before do
create(:sales_log, assigned_to: user)
get root_path
end
[
{ type: "lettings", status: "in_progress" },
{ type: "lettings", status: "completed" },
{ type: "sales", status: "in_progress" },
{ type: "sales", status: "completed" },
].each do |test_case|
it "shows the correct links for #{test_case[:status]} #{test_case[:type]}" do
databoxes = all_databoxes(test_case[:type], test_case[:status])
expect(databoxes.count).to be 2
links = databoxes.map { |databox| link_from_databox databox }
expect(links.map(&:path)).to all eq send("#{test_case[:type]}_logs_path")
params = links.map { |link| CGI.parse(link.query) }
expect(params.map { |prms| prms["status[]"] }).to all eq [test_case[:status]]
expect(params.first["years[]"]).to eq [(current_year - 1).to_s]
expect(params.second["years[]"]).to eq [current_year.to_s]
end
end
it "shows the correct links for incomplete schemes" do
type = "schemes"
status = "incomplete"
databoxes = all_databoxes(type, status)
expect(databoxes.count).to be 1
link = databoxes.map { |databox| link_from_databox databox }.first
expect(link.path).to eq schemes_path
params = CGI.parse(link.query)
expect(params["status[]"]).to eq [status]
end
end
describe "the counts displayed" do
let(:in_crossover_period) { true }
let(:org_1) { create(:organisation) }
let(:org_2) { create(:organisation) }
let(:provider_1) { create(:user, :data_provider, organisation: org_1) }
let(:provider_2) { create(:user, :data_provider, organisation: org_2) }
let(:coordinator) { create(:user, :data_coordinator, organisation: org_1) }
let(:support_user) { create(:user, :support) }
context "and logged in as a provider" do
let(:user) { provider_1 }
it "shows the correct counts of logs created by them" do
last_year_in_progress_count = 2
this_year_in_progress_count = 3
create_list(:lettings_log, last_year_in_progress_count, :in_progress, assigned_to: provider_1, startdate: Time.zone.today - 1.year)
create_list(:lettings_log, this_year_in_progress_count, :in_progress, assigned_to: provider_1, startdate: Time.zone.today)
get root_path
type = "lettings"
status = "in_progress"
databoxes = all_databoxes(type, status)
counts = databoxes.map { |databox| count_from_databox databox }
expect(counts).to eq [last_year_in_progress_count, this_year_in_progress_count]
end
it "does not include logs created by other users in the count, whether in their organisation or not" do
create(:lettings_log, :in_progress, assigned_to: coordinator, startdate: Time.zone.today - 1.year)
create(:lettings_log, :in_progress, assigned_to: provider_2, startdate: Time.zone.today)
get root_path
type = "lettings"
status = "in_progress"
databoxes = all_databoxes(type, status)
counts = databoxes.map { |databox| count_from_databox databox }
expect(counts).to eq [0, 0]
end
end
context "and logged in as a coordinator" do
let(:user) { coordinator }
it "shows the correct counts of logs created by all users in their organisation" do
last_year_in_progress_count = 2
this_year_in_progress_count = 3
create_list(:lettings_log, last_year_in_progress_count, :in_progress, assigned_to: provider_1, startdate: Time.zone.today - 1.year)
create_list(:lettings_log, this_year_in_progress_count, :in_progress, assigned_to: coordinator, startdate: Time.zone.today)
get root_path
type = "lettings"
status = "in_progress"
databoxes = all_databoxes(type, status)
counts = databoxes.map { |databox| count_from_databox databox }
expect(counts).to eq [last_year_in_progress_count, this_year_in_progress_count]
end
it "does not include logs created by users from other organisations in the count" do
create(:lettings_log, :in_progress, assigned_to: provider_2, startdate: Time.zone.today)
get root_path
type = "lettings"
status = "in_progress"
databoxes = all_databoxes(type, status)
counts = databoxes.map { |databox| count_from_databox databox }
expect(counts).to eq [0, 0]
end
end
context "and logged in as a support user" do
let(:user) { support_user }
it "shows the correct counts of all logs from all orgs" do
provider_1_lettings_last_year_in_progress_count = 2
coordinator_lettings_this_year_in_progress_count = 3
provider_2_lettings_last_year_in_progress_count = 2
provider_2_sales_this_year_in_progress_count = 3
create_list(:lettings_log, provider_1_lettings_last_year_in_progress_count, :in_progress, assigned_to: provider_1, startdate: Time.zone.today - 1.year)
create_list(:lettings_log, coordinator_lettings_this_year_in_progress_count, :in_progress, assigned_to: coordinator, startdate: Time.zone.today)
create_list(:lettings_log, provider_2_lettings_last_year_in_progress_count, :in_progress, assigned_to: provider_2, startdate: Time.zone.today - 1.year)
create_list(:sales_log, provider_2_sales_this_year_in_progress_count, :in_progress, assigned_to: provider_2, saledate: Time.zone.today)
get root_path
type = "lettings"
status = "in_progress"
lettings_databoxes = all_databoxes(type, status)
lettings_counts = lettings_databoxes.map { |databox| count_from_databox databox }
expect(lettings_counts).to eq [
provider_1_lettings_last_year_in_progress_count + provider_2_lettings_last_year_in_progress_count,
coordinator_lettings_this_year_in_progress_count,
]
type = "sales"
status = "in_progress"
sales_databoxes = all_databoxes(type, status)
sales_counts = sales_databoxes.map { |databox| count_from_databox databox }
expect(sales_counts).to eq [
0,
provider_2_sales_this_year_in_progress_count,
]
end
end
end
end
context "and 2023 collection window is open for editing" do
before do
allow(Time).to receive(:now).and_return(Time.zone.local(2024, 1, 1))
end
it "displays correct resources for 2023/24 and 2024/25 collection years" do
get "/", headers: headers, params: {}
get root_path
expect(page).to have_content("Lettings 24/25")
expect(page).to have_content("Lettings 23/24")
expect(page).to have_content("Lettings 2024 to 2025")
@ -56,7 +327,7 @@ RSpec.describe StartController, type: :request do
end
it "displays correct resources for 2023/24 and 2024/25 collection years" do
get "/", headers: headers, params: {}
get root_path
expect(page).to have_content("Lettings 24/25")
expect(page).not_to have_content("Lettings 23/24")
expect(page).to have_content("Lettings 2024 to 2025")
@ -69,12 +340,12 @@ RSpec.describe StartController, type: :request do
end
it "shows guidance link" do
get "/", headers: headers, params: {}
get root_path
expect(page).to have_content("Guidance for submitting social housing lettings and sales data (CORE)")
end
it "displays About this service section" do
get "/", headers:, params: {}
get root_path
expect(page).to have_content("About this service")
end
end
@ -83,7 +354,7 @@ RSpec.describe StartController, type: :request do
describe "guidance page" do
context "when the user is not signed in" do
it "routes user to the guidance page" do
get "/guidance", headers:, params: {}
get guidance_path
expect(page).to have_content("Guidance for submitting social housing lettings and sales data")
end
end
@ -94,9 +365,27 @@ RSpec.describe StartController, type: :request do
end
it "routes user to the guidance page" do
get "/guidance", headers:, params: {}
get guidance_path
expect(page).to have_content("Guidance for submitting social housing lettings and sales data")
end
end
end
private
def all_databoxes(type, status)
databoxes = page.find_all(".app-data-box__upper")
databoxes.select do |box|
box.text.downcase.include?(type) &&
box.text.downcase.include?(status.humanize.downcase)
end
end
def link_from_databox(databox)
URI.parse(databox.first("a")[:href])
end
def count_from_databox(databox)
databox.first("a").text.to_i
end
end

2
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -107,7 +107,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
end
end
context "when testing valid/invalid attributes" do
describe "valid/invalid attributes" do
let(:valid_attributes) do
{
bulk_upload:,

2
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -125,7 +125,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
end
end
context "when testing valid/invalid attributes" do
describe "valid/invalid attributes" do
let(:valid_attributes) do
{
bulk_upload:,

Loading…
Cancel
Save