Skip to content

Commit

Permalink
7210-client-search-performance
Browse files Browse the repository at this point in the history
  • Loading branch information
ttoomey committed Feb 6, 2025
1 parent aa7fd37 commit cebbfbe
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions app/models/grda_warehouse/source_client_name_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion app/models/grda_warehouse/source_client_view_accessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<DestinationClient>] Collection of destination clients to load data for
# @raise [RuntimeError] if a destination client reference is missing
def initialize(user:)
@user = user
Expand Down
8 changes: 4 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/assigned/clients/_client_table.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cebbfbe

Please sign in to comment.