summaryrefslogtreecommitdiff
path: root/app/Console/ProjectDailyStatsCalculationCommand.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Console/ProjectDailyStatsCalculationCommand.php')
-rw-r--r--app/Console/ProjectDailyStatsCalculationCommand.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/Console/ProjectDailyStatsCalculationCommand.php b/app/Console/ProjectDailyStatsCalculationCommand.php
new file mode 100644
index 00000000..5b898f02
--- /dev/null
+++ b/app/Console/ProjectDailyStatsCalculationCommand.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Kanboard\Console;
+
+use Kanboard\Model\Project;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class ProjectDailyStatsCalculationCommand extends BaseCommand
+{
+ protected function configure()
+ {
+ $this
+ ->setName('projects:daily-stats')
+ ->setDescription('Calculate daily statistics for all projects');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $projects = $this->project->getAllByStatus(Project::ACTIVE);
+
+ foreach ($projects as $project) {
+ $output->writeln('Run calculation for '.$project['name']);
+ $this->projectDailyColumnStats->updateTotals($project['id'], date('Y-m-d'));
+ $this->projectDailyStats->updateTotals($project['id'], date('Y-m-d'));
+ }
+ }
+}