fix: [appTable:activityStatistics] Variation take for the activity of the last x days

pull/93/head
Sami Mokaddem 2022-01-20 09:05:02 +01:00
parent 324ac1ce40
commit 6be08e3100
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 1 additions and 3 deletions

View File

@ -107,9 +107,7 @@ class AppTable extends Table
$statistics['amount'] = $table->find()->all()->count();
if ($table->behaviors()->has('Timestamp') && $includeTimeline) {
$statistics['timeline'] = $this->buildTimeline($table, $days, $field);
$startCount = $table->find()->where(["{$field} >" => new \DateTime("-{$days} days")])->all()->count();
$endCount = $statistics['amount'];
$statistics['variation'] = $startCount - $endCount;
$statistics['variation'] = $table->find()->where(["{$field} >" => new \DateTime("-{$days} days")])->all()->count();
} else {
$statistics['timeline'] = [];
$statistics['variation'] = 0;