File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1+ # Don't technically need to pull in csv for the code itself,
2+ # but this ensures that the unit test can run in isolation
3+ require 'csv'
4+
15module Exports
26 class ExportDistributionsCSVService
37 include DistributionHelper
@@ -135,7 +139,8 @@ def build_row_data(distribution)
135139 row = base_table . values . map { |closure | closure . call ( distribution ) }
136140
137141 item_names . each do |item_name |
138- line_items = distribution . line_items . where ( item : @organization . items . find_by ( name : item_name ) )
142+ # We are doing this in-memory so that we can use the already-loaded line item records
143+ line_items = distribution . line_items . select { |item | item . name == item_name }
139144
140145 row << line_items . sum ( &:quantity )
141146 row << Money . new ( line_items . sum ( &:value_per_line_item ) ) if @organization . include_in_kind_values_in_exported_files
You can’t perform that action at this time.
0 commit comments