Commit 2bcd4345 authored by Cédric Girardot's avatar Cédric Girardot

Fix : Corrige affichage 5 derniers mois dans les stats

Change-Id: Ia8229e88949fd404efb3439f9e00ce80072811df
parent 4cf64837
Pipeline #10409 passed with stages
in 4 minutes and 11 seconds
......@@ -53,14 +53,11 @@ class StatsController extends BaseController
public function statsAction(Request $request)
{
$dateTo = new DateTime();
$dateFrom = new DateTime();
$dateFrom->sub(new \DateInterval("P4M")); // affiche au maximum 5 mois
$dateFrom->setDate(
intval($dateFrom->format("Y")),
intval($dateFrom->format("m")),
1
); // force au premier jour du mois
$dateFrom->setTime(0, 0); // force l'heure à 00:00
$dateTo->setTime(23, 59, 59, 999999);
$dateFrom = clone $dateTo;
$dateFrom
->modify('first day of -4 month') // affiche au maximum 5 mois
->setTime(0, 0); // force l'heure à 00:00
[$stats, $tableHeader] = $this->getStats($dateFrom, $dateTo);
......@@ -198,7 +195,6 @@ class StatsController extends BaseController
/** @var UserLogRepository $userLogRepository */
$userLogRepository = $entityManager->getRepository(UserLog::class);
$monthly = new \DateInterval('P1M');
$stats = [];
$monthsList = [];
$iDate = clone $dateTo;
......@@ -219,7 +215,7 @@ class StatsController extends BaseController
'nbUniqueUsers' => 0,
];
$iDate->sub($monthly);
$iDate->modify('last day of previous month');
}
$searchStatsResult = $searchLogRepository->findSearchStats($dateFrom, $dateTo);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment