From 08259d4f206438095308749b8cc2abbe629137da Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 6 Jul 2015 21:34:57 -0400 Subject: Add lead and cycle time for projects --- app/Console/ProjectDailyColumnStatsExport.php | 34 ++++++++++++++++++++++++++ app/Console/ProjectDailyStatsCalculation.php | 28 +++++++++++++++++++++ app/Console/ProjectDailySummaryCalculation.php | 27 -------------------- app/Console/ProjectDailySummaryExport.php | 34 -------------------------- 4 files changed, 62 insertions(+), 61 deletions(-) create mode 100644 app/Console/ProjectDailyColumnStatsExport.php create mode 100644 app/Console/ProjectDailyStatsCalculation.php delete mode 100644 app/Console/ProjectDailySummaryCalculation.php delete mode 100644 app/Console/ProjectDailySummaryExport.php (limited to 'app/Console') diff --git a/app/Console/ProjectDailyColumnStatsExport.php b/app/Console/ProjectDailyColumnStatsExport.php new file mode 100644 index 00000000..b9830662 --- /dev/null +++ b/app/Console/ProjectDailyColumnStatsExport.php @@ -0,0 +1,34 @@ +setName('export:daily-project-column-stats') + ->setDescription('Daily project column stats CSV export (number of tasks per column and per day)') + ->addArgument('project_id', InputArgument::REQUIRED, 'Project id') + ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)') + ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $data = $this->projectDailyColumnStats->getAggregatedMetrics( + $input->getArgument('project_id'), + $input->getArgument('start_date'), + $input->getArgument('end_date') + ); + + if (is_array($data)) { + Tool::csv($data); + } + } +} diff --git a/app/Console/ProjectDailyStatsCalculation.php b/app/Console/ProjectDailyStatsCalculation.php new file mode 100644 index 00000000..4b77c556 --- /dev/null +++ b/app/Console/ProjectDailyStatsCalculation.php @@ -0,0 +1,28 @@ +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')); + } + } +} diff --git a/app/Console/ProjectDailySummaryCalculation.php b/app/Console/ProjectDailySummaryCalculation.php deleted file mode 100644 index b2ada1b6..00000000 --- a/app/Console/ProjectDailySummaryCalculation.php +++ /dev/null @@ -1,27 +0,0 @@ -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')); - } - } -} diff --git a/app/Console/ProjectDailySummaryExport.php b/app/Console/ProjectDailySummaryExport.php deleted file mode 100644 index 07841d52..00000000 --- a/app/Console/ProjectDailySummaryExport.php +++ /dev/null @@ -1,34 +0,0 @@ -setName('export:daily-project-summary') - ->setDescription('Daily project summary CSV export (number of tasks per column and per day)') - ->addArgument('project_id', InputArgument::REQUIRED, 'Project id') - ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)') - ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $data = $this->projectDailySummary->getAggregatedMetrics( - $input->getArgument('project_id'), - $input->getArgument('start_date'), - $input->getArgument('end_date') - ); - - if (is_array($data)) { - Tool::csv($data); - } - } -} -- cgit v1.2.3