From 24004e188b89c952d600beccaddc660db253232a Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Tue, 22 May 2018 11:29:29 -0500 Subject: [PATCH] Fixes bug where donations for events aren't listed as associated with event on payout report --- lib/query/query_payments.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/query/query_payments.rb b/lib/query/query_payments.rb index 7b349929..6d8d90a8 100644 --- a/lib/query/query_payments.rb +++ b/lib/query/query_payments.rb @@ -254,7 +254,7 @@ module QueryPayments .concat([[]]) .concat( Qx.select([ - "to_char(payments.date, 'MM/DD/YYY HH24:MIam') AS \"Date\"", + "to_char(payments.date, 'MM/DD/YYYY HH24:MIam') AS \"Date\"", "(payments.gross_amount/100.0)::money::text AS \"Gross Amount\"", "(payments.fee_total / 100.0)::money::text AS \"Fee Total\"", "(payments.net_amount / 100.0)::money::text AS \"Net Amount\"", @@ -281,7 +281,7 @@ module QueryPayments .add_left_join(:campaign_gifts, "donations.id=campaign_gifts.donation_id") .add_left_join(:campaign_gift_options, "campaign_gift_options.id=campaign_gifts.campaign_gift_option_id") .add_left_join(tickets_subquery, "tickets.payment_id=payments.id") - .add_left_join(:events, "events.id=tickets.event_id") + .add_left_join(:events, "events.id=tickets.event_id OR (events.id = donations.event_id)") .where("payouts.id=$id", id: payout_id) .and_where("payments.nonprofit_id=$id", id: npo_id) .order_by("payments.date DESC, payments.id")