From: Steve Sutton Date: Wed, 24 Aug 2016 19:44:57 +0000 (-0400) Subject: Update the date to search for leads data. X-Git-Tag: v1.1.0^2~6^2~4 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=99997c4c8d7c9f8d455558087c0428a9c39d3aa9;p=WP-Plugins%2Fglm-member-db-leads.git Update the date to search for leads data. Adjusting the start and end range for pulling weekly and monthly data. --- diff --git a/models/admin/ajax/statCollector.php b/models/admin/ajax/statCollector.php index 9da44bb..3cfb582 100644 --- a/models/admin/ajax/statCollector.php +++ b/models/admin/ajax/statCollector.php @@ -144,9 +144,11 @@ class GlmMembersAdmin_ajax_statCollector $last_stat_date = $this->getLastStatDate( 'weekly' ); if ( $last_stat_date != self::STAT_START_DATE ) { $stat_date = new DateTime( $last_stat_date ); - $stat_date->modify( '+ 2 week' ); + $stat_date->modify( '+ 1 week' ); $last_stat_date = $stat_date->format( 'Y-m-d' ); } + $current_date = new DateTime(); + $current_date->modify( '+ 2 weeks' ); $results = $this->wpdb->get_results( $this->wpdb->prepare( "SELECT count(id) as leads_count,DATE_FORMAT(date_submitted, '%%Y%%U') as weekly @@ -154,7 +156,7 @@ class GlmMembersAdmin_ajax_statCollector WHERE date_submitted < %s AND date_submitted > %s GROUP BY weekly", - current_time( 'Y-m-d' ), + $current_date->format( 'Y-m-d' ), $last_stat_date ), ARRAY_A @@ -190,9 +192,11 @@ class GlmMembersAdmin_ajax_statCollector $last_stat_date = $this->getLastStatDate( 'monthly' ); if ( $last_stat_date != self::STAT_START_DATE ) { $stat_date = new DateTime( $last_stat_date ); - $stat_date->modify( '+ 2 month' ); + $stat_date->modify( '+ 1 month' ); $last_stat_date = $stat_date->format( 'Y-m-d' ); } + $current_date = new DateTime(); + $current_date->modify( '+ 2 months' ); $sql = " SELECT count(id) as leads_count,DATE_FORMAT(date_submitted, '%Y%m') as monthly FROM " . GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX . "lead_entry @@ -205,7 +209,7 @@ class GlmMembersAdmin_ajax_statCollector WHERE date_submitted < %s AND date_submitted > %s GROUP BY monthly", - current_time( 'Y-m-d' ), + $current_date->format( 'Y-m-d' ), $last_stat_date ), ARRAY_A