Skip to content

Commit

Permalink
Merge pull request #4661 from jparcill/jparcill/export_donations_in_kind
Browse files Browse the repository at this point in the history
Export In Kind in donations csv
  • Loading branch information
cielf authored Sep 20, 2024
2 parents 8e26163 + b42e531 commit 51ed96b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/donation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def storage_view
storage_location.nil? ? "N/A" : storage_location.name
end

def in_kind_value_money
Money.new(value_per_itemizable)
end

private

def combine_duplicates
Expand Down
3 changes: 3 additions & 0 deletions app/services/exports/export_donations_csv_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def base_table
"Variety of Items" => ->(donation) {
donation.line_items.map(&:name).uniq.size
},
"In-Kind Value" => ->(donation) {
donation.in_kind_value_money
},
"Comments" => ->(donation) {
donation.comment
}
Expand Down
2 changes: 2 additions & 0 deletions spec/services/exports/export_donations_csv_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Storage Location",
"Quantity of Items",
"Variety of Items",
"In-Kind Value",
"Comments"
] + expected_item_headers
end
Expand Down Expand Up @@ -84,6 +85,7 @@
donation.storage_view,
donation.line_items.total,
total_item_quantity.count(&:positive?),
donation.in_kind_value_money,
donation.comment
]

Expand Down

0 comments on commit 51ed96b

Please sign in to comment.