diff --git a/app/models/donation.rb b/app/models/donation.rb index 2100b738af..6fb1466d78 100644 --- a/app/models/donation.rb +++ b/app/models/donation.rb @@ -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 diff --git a/app/services/exports/export_donations_csv_service.rb b/app/services/exports/export_donations_csv_service.rb index 254ebcd196..6e600ea09b 100644 --- a/app/services/exports/export_donations_csv_service.rb +++ b/app/services/exports/export_donations_csv_service.rb @@ -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 } diff --git a/spec/services/exports/export_donations_csv_service_spec.rb b/spec/services/exports/export_donations_csv_service_spec.rb index 237c1a4513..7990929f63 100644 --- a/spec/services/exports/export_donations_csv_service_spec.rb +++ b/spec/services/exports/export_donations_csv_service_spec.rb @@ -51,6 +51,7 @@ "Storage Location", "Quantity of Items", "Variety of Items", + "In-Kind Value", "Comments" ] + expected_item_headers end @@ -84,6 +85,7 @@ donation.storage_view, donation.line_items.total, total_item_quantity.count(&:positive?), + donation.in_kind_value_money, donation.comment ]