From c8a969985073f8586ebd1d9788ef01bcb613c7ba Mon Sep 17 00:00:00 2001 From: Daniel Camargo Date: Wed, 31 Jul 2013 13:01:27 -0300 Subject: [PATCH] partial #1523 --- include/library/Crunchbutton/Chart.php | 7 ++++--- include/library/Crunchbutton/Chart/User.php | 1 - include/views/default/cockpit/charts/area.phtml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/library/Crunchbutton/Chart.php b/include/library/Crunchbutton/Chart.php index a163a30c1..f8f8c3172 100644 --- a/include/library/Crunchbutton/Chart.php +++ b/include/library/Crunchbutton/Chart.php @@ -6,6 +6,7 @@ class Crunchbutton_Chart extends Cana_Model { public $queryOnlyCommunties = 'AND c.id_community IN (1, 4)'; public $queryExcludeCommunties = "AND c.name != 'Testing' AND c.name IS NOT NULL"; public $queryExcludeUsers = "AND o.name NOT LIKE '%test%' and o.name != 'Judd' and o.name != 'dave' and o.name != 'Nick' and o.name != 'Devin'"; + public $minDate = '2012-09-02'; #Issue 1523 - Fist week of September/12 public $from_month; public $to_month; @@ -179,7 +180,7 @@ class Crunchbutton_Chart extends Cana_Model { public function allMonths(){ if( !$this->_months ){ - $query = "SELECT DISTINCT( DATE_FORMAT( o.date ,'%Y-%m') ) month FROM `order` o WHERE o.date IS NOT NULL ORDER BY month ASC"; + $query = "SELECT DISTINCT( DATE_FORMAT( o.date ,'%Y-%m') ) month FROM `order` o WHERE o.date IS NOT NULL AND o.date > '$this->minDate' ORDER BY month ASC"; $results = c::db()->get( $query ); $months = array(); foreach ( $results as $result ) { @@ -212,7 +213,7 @@ class Crunchbutton_Chart extends Cana_Model { } public function allDays(){ - $query = "SELECT DISTINCT( DATE_FORMAT( o.date ,'%Y-%m-%d') ) day FROM `order` o WHERE o.date IS NOT NULL ORDER BY day ASC"; + $query = "SELECT DISTINCT( DATE_FORMAT( o.date ,'%Y-%m-%d') ) day FROM `order` o WHERE o.date IS NOT NULL AND o.date > '$this->minDate' ORDER BY day ASC"; $results = c::db()->get( $query ); $days = array(); foreach ( $results as $result ) { @@ -231,7 +232,7 @@ class Crunchbutton_Chart extends Cana_Model { public function allWeeks(){ if( !$this->_weeks ){ - $query = "SELECT DISTINCT( YEARWEEK( o.date ) ) week FROM `order` o WHERE YEARWEEK( o.date ) IS NOT NULL ORDER BY week ASC"; + $query = "SELECT DISTINCT( YEARWEEK( o.date ) ) week FROM `order` o WHERE YEARWEEK( o.date ) IS NOT NULL AND o.date > '$this->minDate' ORDER BY week ASC"; $results = c::db()->get( $query ); $weeks = array(); foreach ( $results as $result ) { diff --git a/include/library/Crunchbutton/Chart/User.php b/include/library/Crunchbutton/Chart/User.php index aab46bbba..386b87914 100644 --- a/include/library/Crunchbutton/Chart/User.php +++ b/include/library/Crunchbutton/Chart/User.php @@ -244,7 +244,6 @@ class Crunchbutton_Chart_User extends Crunchbutton_Chart { $union = ''; $allMonths = $this->allMonths(); - for( $i = $this->from_month -1 ; $i < $this->to_month; $i++ ){ $month = $allMonths[ $i ]; $query .= $union . "SELECT '{$month}' AS Month, diff --git a/include/views/default/cockpit/charts/area.phtml b/include/views/default/cockpit/charts/area.phtml index 597c945b1..5887b7a4f 100644 --- a/include/views/default/cockpit/charts/area.phtml +++ b/include/views/default/cockpit/charts/area.phtml @@ -163,7 +163,7 @@ $(function () { rotation: -45, align: 'right' ,step:10 - ,step:2 + ,step:2 } }, yAxis: {