r86661 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86660‎ | r86661 | r86662 >
Date:20:00, 21 April 2011
Author:awjrichards
Status:deferred
Tags:
Comment:
Fixed bad accounting when accumulating country counts for allocations; Fixed bug where country data was being double counted in drush script
Modified paths:
  • /civicrm/trunk/sites/all/modules/contribution_audit/allocate_unallocated_contribs.drush.inc (modified) (history)
  • /civicrm/trunk/sites/all/modules/contribution_audit/contribution_audit.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/contribution_audit/contribution_audit.module
@@ -51,6 +51,7 @@
5252 $allocated = array(); // country => $
5353 // find the info from missing trxns
5454 $missing_trxns = contribution_audit_find_missing_trxns( $start_date, $end_date );
 55+ watchdog( 'contribution_audit', 'Total missing transactions: @num', array('@num' => count( $missing_trxns )), WATCHDOG_DEBUG );
5556 foreach ( $missing_trxns as $missing_trxn ) {
5657 // what happens if we still dont have country data?
5758 if ( !strlen($missing_trxn[ 'country' ])) {
@@ -70,7 +71,7 @@
7172 $allocated[ $trxn[ 'country' ]][ 'count' ] = 1;
7273 } else {
7374 $allocated[ $trxn[ 'country' ]][ 'amnt' ] += $trxn[ 'gross' ];
74 - $allocated[ $trxn[ 'country' ]][ 'count' ]++;
 75+ $allocated[ $trxn[ 'country' ]][ 'count' ] += 1;
7576 }
7677 }
7778
Index: civicrm/trunk/sites/all/modules/contribution_audit/allocate_unallocated_contribs.drush.inc
@@ -75,7 +75,7 @@
7676 function allocate_unallocated_contribs_merge( &$allocated, $local_allocated ) {
7777 foreach ( $local_allocated as $country => $data ) {
7878 if ( !in_array( $country, array_keys( $allocated ))) {
79 - $allocated = array_merge( $allocated, $local_allocated );
 79+ $allocated[$country] = $local_allocated[$country];
8080 } else {
8181 $allocated[ $country ][ 'amnt' ] += $local_allocated[ $country ][ 'amnt' ];
8282 $allocated[ $country ][ 'count' ] += $local_allocated[ $country ][ 'count' ];

Status & tagging log