Add campaign_id to export
This commit is contained in:
parent
bcb84d2aab
commit
22ea10c65e
2 changed files with 19 additions and 0 deletions
|
@ -14,7 +14,21 @@ module QueryDonations
|
||||||
].concat(QuerySupporters.supporter_export_selections)
|
].concat(QuerySupporters.supporter_export_selections)
|
||||||
.concat([
|
.concat([
|
||||||
"supporters.id AS \"Supporter ID\"",
|
"supporters.id AS \"Supporter ID\"",
|
||||||
|
<<<<<<< HEAD
|
||||||
])
|
])
|
||||||
|
=======
|
||||||
|
]).concat([
|
||||||
|
"coalesce(donations.designation, 'None') AS designation",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty('type')}::text AS \"Dedication Type\"",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty('name')}::text AS \"Dedicated To: Name\"",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty('supporter_id')}::text AS \"Dedicated To: Supporter ID\"",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty('contact', 'email')}::text AS \"Dedicated To: Email\"",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty('contact', "phone")}::text AS \"Dedicated To: Phone\"",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty( "contact", "address")}::text AS \"Dedicated To: Address\"",
|
||||||
|
"#{QueryPayments.get_dedication_or_empty( "note")}::text AS \"Dedicated To: Note\"",
|
||||||
|
"donations.campaign_id AS \"Campaign Id\""
|
||||||
|
])
|
||||||
|
>>>>>>> 5c0d16c0b... Add campaign_id to export
|
||||||
).from(:donations)
|
).from(:donations)
|
||||||
.join(:supporters, "supporters.id=donations.supporter_id")
|
.join(:supporters, "supporters.id=donations.supporter_id")
|
||||||
.left_outer_join(:campaign_gifts, "campaign_gifts.donation_id=donations.id")
|
.left_outer_join(:campaign_gifts, "campaign_gifts.donation_id=donations.id")
|
||||||
|
|
|
@ -45,6 +45,11 @@ describe QueryDonations do
|
||||||
|
|
||||||
expect(export.map{|i| i['Amount']}).to match_array(['$10.00', '$20.00', '$40.00', '$80.00'])
|
expect(export.map{|i| i['Amount']}).to match_array(['$10.00', '$20.00', '$40.00', '$80.00'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'includes the campaign ids' do
|
||||||
|
export = vector_to_hash(campaign_export)
|
||||||
|
expect(export.map{|i| i['Campaign Id']}).to match_array([campaign.id, campaign.id, campaign_child.id, campaign_child_2.id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
## move to common area
|
## move to common area
|
||||||
|
|
Loading…
Reference in a new issue