Merge branch 'master' of github.com:crunchbutton/crunchbutton

This commit is contained in:
pererinha 2013-06-21 17:41:53 -04:00
commit c8f40bc4ce
2 changed files with 6 additions and 16 deletions

View File

@ -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':

View File

@ -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',*/
),
);