Browse Source

[Administration] Statistiques admin : commandes clients des 30 derniers jours

master
Guillaume Bourgeois 1 year ago
parent
commit
796b5b0964
2 changed files with 3 additions and 4 deletions
  1. +1
    -2
      backend/controllers/StatsAdminController.php
  2. +2
    -2
      common/logic/Order/Order/Repository/OrderRepository.php

+ 1
- 2
backend/controllers/StatsAdminController.php View File

$period = new DatePeriod($start, $interval, $end); $period = new DatePeriod($start, $interval, $end);


foreach ($period as $date) { foreach ($period as $date) {

$dateFormat = date('d/m/Y', $date->getTimestamp()); $dateFormat = date('d/m/Y', $date->getTimestamp());
$dataLabels[] = $dateFormat; $dataLabels[] = $dateFormat;
$data[] = $orderManager->countOrdersByDateAndOrigin($date);
$data[] = $orderManager->countGlobalOrdersByDateAndOrigin($date);
} }


return $this->render('index', [ return $this->render('index', [

+ 2
- 2
common/logic/Order/Order/Repository/OrderRepository.php View File

->findOne(); ->findOne();
} }


public function countOrdersByDateAndOrigin(\DateTime $date, string $origin = Order::ORIGIN_USER)
public function countGlobalOrdersByDateAndOrigin(\DateTime $date, string $origin = Order::ORIGIN_USER)
{ {
return $this->createDefaultQuery()
return $this->createQuery()
->filterByDate($date) ->filterByDate($date)
->filterByOrigin($origin) ->filterByOrigin($origin)
->count(); ->count();

Loading…
Cancel
Save