From 0e16699633317106f029a20dbfd076583aa4db81 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 12 Dec 2023 09:25:28 +0000 Subject: [PATCH] feat: update org schemes controller with org schemes (and rename for clarity) --- app/controllers/organisations_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 58b2d08d5..84a7e5186 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -21,16 +21,16 @@ class OrganisationsController < ApplicationController end def schemes - all_schemes = Scheme.where(owning_organisation: [@organisation] + @organisation.parent_organisations) + organisation_schemes = Scheme.where(owning_organisation: [@organisation] + @organisation.parent_organisations) - @pagy, @schemes = pagy(filter_manager.filtered_schemes(all_schemes, search_term, session_filters).order_by_service_name) + @pagy, @schemes = pagy(filter_manager.filtered_schemes(organisation_schemes, search_term, session_filters).order_by_service_name) @searched = search_term.presence - @total_count = all_schemes.size + @total_count = organisation_schemes.size @filter_type = "schemes" end def download_schemes_csv - organisation_schemes = Scheme.where(owning_organisation_id: @organisation.id) + organisation_schemes = Scheme.where(owning_organisation: [@organisation] + @organisation.parent_organisations) unpaginated_filtered_schemes = filter_manager.filtered_schemes(organisation_schemes, search_term, session_filters) render "schemes/download_csv", locals: { search_term:, post_path: email_csv_schemes_path, download_type: params[:download_type], schemes: unpaginated_filtered_schemes }