Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gigxz committed Feb 2, 2025
1 parent 04bd402 commit 022de61
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def run!
total = pathway_client_warehouse_id_to_client_ids.count
Rails.logger.info "There are #{total} clients with pathways to export"

# Iterate through each Destination Client that has Source Client(s) with any Pathway values
pathway_client_warehouse_id_to_client_ids.each do |warehouse_id, client_ids|
# Find the pathway CDE that was most recently updated for this destination client
most_recent_pathway_cde = client_ids.map { |id| pathways_by_client_id[id] }.flatten.max_by(&:date_updated)
Expand Down Expand Up @@ -102,9 +103,7 @@ def columns
group_by(&:owner_id) # By Client ID
end

# { source client id => warehouse destination client id }
# This drops the source client id if there are multiple source clients with pathways,
# so that the resulting CSV does not have duplicated destination client IDs.
# { <warehouse destination client id> => [ <source client ids that have pathways> ] }
private def pathway_client_warehouse_id_to_client_ids
@pathway_client_warehouse_id_to_client_ids ||= Hmis::WarehouseClient.joins(:source).
where(data_source_id: data_source.id).
Expand Down

0 comments on commit 022de61

Please sign in to comment.