Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316716

Change subject: Filter refunds out of donation history
......................................................................

Filter refunds out of donation history

Apply the same filters as for the latest_donation logic.

Bug: T148062
Change-Id: If78471c395110016c0d95a2094cbb7b32d6c032f
---
M silverpop_export/update_table.sql
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/16/316716/1

diff --git a/silverpop_export/update_table.sql 
b/silverpop_export/update_table.sql
index 9773cd4..e5aff51 100755
--- a/silverpop_export/update_table.sql
+++ b/silverpop_export/update_table.sql
@@ -189,7 +189,9 @@
   FROM civicrm.civicrm_email e FORCE INDEX(UI_email)
   JOIN silverpop_export_staging ex ON e.email=ex.email
   JOIN civicrm.civicrm_contribution ct ON e.contact_id=ct.contact_id
-  WHERE ct.total_amount IS NOT NULL
+  WHERE ct.receive_date IS NOT NULL AND
+    ct.total_amount > 0 AND -- Refunds don't count
+    ct.contribution_status_id = 1 -- Only completed status
   GROUP BY e.email;
 
 -- (10 minutes)

-- 
To view, visit https://gerrit.wikimedia.org/r/316716
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If78471c395110016c0d95a2094cbb7b32d6c032f
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to