From ce6da3f63716cce32b4edcf17cb5d0d1e861097b Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 20 Oct 2023 15:56:57 +0100 Subject: [PATCH] refactor: reorganise filter lists --- app/helpers/filters_helper.rb | 2 +- spec/features/organisation_spec.rb | 1 - spec/models/user_spec.rb | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/helpers/filters_helper.rb b/app/helpers/filters_helper.rb index fa2665177..11c6058bd 100644 --- a/app/helpers/filters_helper.rb +++ b/app/helpers/filters_helper.rb @@ -154,7 +154,7 @@ private def filters_count(filters) filters.each.sum do |category, category_filters| - if %w[status needstypes years bulk_upload_id].include?(category) + if %w[years status needstypes bulk_upload_id].include?(category) category_filters.count(&:present?) elsif %w[user owning_organisation managing_organisation].include?(category) 1 diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index dc4f6dc39..2ff74ac9d 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -212,7 +212,6 @@ RSpec.describe "User Features" do other_supported_housing_logs.each do |supported_housing_log| expect(page).not_to have_link supported_housing_log.id.to_s, href: "/lettings-logs/#{supported_housing_log.id}" end - end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2ea32ce6a..c272320b2 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -163,7 +163,7 @@ RSpec.describe User, type: :model do end it "can filter lettings logs by user, year and status" do - expect(user.logs_filters).to match_array(%w[status needstypes years assigned_to user bulk_upload_id]) + expect(user.logs_filters).to match_array(%w[years status needstypes assigned_to user bulk_upload_id]) end end @@ -173,7 +173,7 @@ RSpec.describe User, type: :model do end it "can filter lettings logs by user, year, status, managing_organisation and owning_organisation" do - expect(user.logs_filters).to match_array(%w[status needstypes years assigned_to user managing_organisation owning_organisation bulk_upload_id]) + expect(user.logs_filters).to match_array(%w[years status needstypes assigned_to user managing_organisation owning_organisation bulk_upload_id]) end end end @@ -214,7 +214,7 @@ RSpec.describe User, type: :model do end it "can filter lettings logs by user, year, status, managing_organisation and owning_organisation" do - expect(user.logs_filters).to match_array(%w[status needstypes years assigned_to user owning_organisation managing_organisation bulk_upload_id]) + expect(user.logs_filters).to match_array(%w[years status needstypes assigned_to user owning_organisation managing_organisation bulk_upload_id]) end end