summaryrefslogtreecommitdiff
path: root/app/Console/ProjectDailySummaryCalculation.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-29 14:01:03 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-29 14:01:03 -0500
commitd6bde1e3ec1d0b0fae7bb85e274e1bebb65d78db (patch)
tree12f26fb81b61a32926cecfd80917a8eb928a4e07 /app/Console/ProjectDailySummaryCalculation.php
parente8fa25f9ca246fea085da46ea705a74b6de30d10 (diff)
Add command line export/calculation for daily project summaries
Diffstat (limited to 'app/Console/ProjectDailySummaryCalculation.php')
-rw-r--r--app/Console/ProjectDailySummaryCalculation.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/Console/ProjectDailySummaryCalculation.php b/app/Console/ProjectDailySummaryCalculation.php
new file mode 100644
index 00000000..04c4083d
--- /dev/null
+++ b/app/Console/ProjectDailySummaryCalculation.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Console;
+
+use Model\Project;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class ProjectDailySummaryCalculation extends Base
+{
+ protected function configure()
+ {
+ $this
+ ->setName('projects:daily-summary')
+ ->setDescription('Calculate daily summary data 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->projectDailySummary->updateTotals($project['id'], date('Y-m-d'));
+ }
+ }
+}