diff --git a/include/controllers/default/cockpit/home/charts.php b/include/controllers/default/cockpit/home/charts.php index 64af814b0..cb5cbe378 100644 --- a/include/controllers/default/cockpit/home/charts.php +++ b/include/controllers/default/cockpit/home/charts.php @@ -428,33 +428,23 @@ class Controller_home_charts extends Crunchbutton_Controller_Account { break; case 'orders-per-week-by-community': - $allWeeks = $this->allWeeks(); - $maxWeeks = sizeof( $allWeeks ); - $weeks = ( $_REQUEST[ 'weeks' ] ? $_REQUEST[ 'weeks' ] : $maxWeeks ); - $actual = $allWeeks[ ( $weeks >= $maxWeek ? ( $weeks - 1 ) : $weeks ) ]; $query = "SELECT CONCAT('Week ', YEARWEEK(date)) AS `week`, COUNT(*) AS Orders, c.name AS 'Community' FROM `order` o INNER JOIN user u ON u.id_user = o.id_user LEFT JOIN community c ON o.id_community = c.id_community - WHERE YEARWEEK(o.date) >= {$actual} + WHERE YEARWEEK(o.date) >= {$weekFrom} AND YEARWEEK(o.date) <= {$weekTo} {$this->queryExcludeCommunties} {$this->queryOnlyCommunties} {$this->queryExcludeUsers} GROUP BY YEARWEEK(date), c.name ORDER BY YEARWEEK(date) DESC"; - c::view()->display('charts/column', ['set' => [ - 'chartId' => $chart, - 'data' => c::db()->get( $query ), - 'title' => $title, - 'number' => $number, - 'unit' => 'orders', - 'maxWeeks' => $maxWeeks, - 'ignoreWeekSum' => true, - 'weeks' => $weeks, - ]]); + $data = $this->parseDataWeeksSimple( $query, 'Orders' ); + + $this->render( array( 'data' => $data, 'unit' => 'orders' ) ); + break; case 'orders-using-giftcard-per-week': diff --git a/include/controllers/default/cockpit/home/index.php b/include/controllers/default/cockpit/home/index.php index e25d1c21e..94f0b16eb 100644 --- a/include/controllers/default/cockpit/home/index.php +++ b/include/controllers/default/cockpit/home/index.php @@ -54,7 +54,7 @@ class Controller_home extends Crunchbutton_Controller_Account { // 'active-users-by-community' => 'Active users by community', 'orders-by-weekday-by-community' => 'Orders by Weekday by Community', 'orders-per-week' => 'Orders per Week', - 'orders-per-week-by-community' => 'Orders per Week by Community', + // 'orders-per-week-by-community' => 'Orders per Week by Community', // 'orders-using-giftcard-per-week' => 'Orders using Gift Card per Week',*/ ), );