From cebbfbe6c5258e8c5f58ca160eb83bdaace0b169 Mon Sep 17 00:00:00 2001 From: Theron Toomey Date: Thu, 6 Feb 2025 19:16:22 +0000 Subject: [PATCH] 7210-client-search-performance --- app/helpers/application_helper.rb | 2 +- app/models/grda_warehouse/source_client_name_set.rb | 6 +++--- app/models/grda_warehouse/source_client_view_accessor.rb | 2 +- app/models/user.rb | 8 ++++---- app/views/assigned/clients/_client_table.haml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 028666e9c7..1d768e233b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -250,7 +250,7 @@ def homeless_service_calendar(options = {}, &block) SimpleCalendar::HomelessService.new(self, options).render(&block) end - # generate HTML snippet representing the name the user is known by in different data sources + # Conditional HTML formatting for client name in different data sources (legacy view code) def render_client_alias(name) if GrdaWarehouse::Config.get(:multi_coc_installation) content_tag(:div, name, class: 'mb-4') diff --git a/app/models/grda_warehouse/source_client_name_set.rb b/app/models/grda_warehouse/source_client_name_set.rb index 6d143ffd66..64536a79b0 100644 --- a/app/models/grda_warehouse/source_client_name_set.rb +++ b/app/models/grda_warehouse/source_client_name_set.rb @@ -22,8 +22,8 @@ def to_str = value def initialize(destination_client:, source_clients:, user:) @names = source_clients.map do |client| SourceClientName.new( - ds_name: client.data_source&.short_name, - ds_id: client.data_source&.id, + ds_name: client.data_source.short_name, + ds_id: client.data_source.id, value: client.pii_provider(user: user).full_name, ) end @@ -33,7 +33,7 @@ def initialize(destination_client:, source_clients:, user:) @names << SourceClientName.new( ds_name: 'Health', ds_id: GrdaWarehouse::DataSource.health_authoritative_id, - value: patient.pii_provider(user: user).brief_name, + value: patient.pii_provider(user: user).full_name, ) end @names.uniq! diff --git a/app/models/grda_warehouse/source_client_view_accessor.rb b/app/models/grda_warehouse/source_client_view_accessor.rb index ed5c88c000..52ddd7c463 100644 --- a/app/models/grda_warehouse/source_client_view_accessor.rb +++ b/app/models/grda_warehouse/source_client_view_accessor.rb @@ -3,12 +3,12 @@ # N+1 queries while providing convenient access to client information. # class GrdaWarehouse::SourceClientViewAccessor + # override inspect to prevent clutter exceptions def inspect object_id end # @param user [User] The current user accessing the client data - # @param clients [Array] Collection of destination clients to load data for # @raise [RuntimeError] if a destination client reference is missing def initialize(user:) @user = user diff --git a/app/models/user.rb b/app/models/user.rb index 1ecadab007..1664151cc0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -244,10 +244,10 @@ def unique_role_names end # View helper for performant access to client details - # clients can be preloaded example: - # current_user.client_view_accessor.preload_source_clients(clients) - # clients.each do |client| - # puts current_user.client_view_accessor.source_clients(client).first + # preloaded clients example: + # current_user.client_view_accessor.preload_source_clients(dest_clients) + # dest_clients.each do |client| + # puts current_user.client_view_accessor.source_clients(client).first # end # def client_view_accessor diff --git a/app/views/assigned/clients/_client_table.haml b/app/views/assigned/clients/_client_table.haml index 1b5f30e27a..631eca702e 100644 --- a/app/views/assigned/clients/_client_table.haml +++ b/app/views/assigned/clients/_client_table.haml @@ -17,7 +17,7 @@ .client__client-name .client-aka = main_client_name - - akas.each do | aka | + - akas.each do |aka| .client__client-name .client-aka= render_client_alias(aka) .client__details.client__details--status