From d6bde1e3ec1d0b0fae7bb85e274e1bebb65d78db Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 29 Nov 2014 14:01:03 -0500 Subject: Add command line export/calculation for daily project summaries --- app/Console/OverdueNotification.php | 69 ------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 app/Console/OverdueNotification.php (limited to 'app/Console/OverdueNotification.php') diff --git a/app/Console/OverdueNotification.php b/app/Console/OverdueNotification.php deleted file mode 100644 index 0987bf2a..00000000 --- a/app/Console/OverdueNotification.php +++ /dev/null @@ -1,69 +0,0 @@ -setName('notification:overdue-tasks') - ->setDescription('Send notifications for overdue tasks') - ->addOption('show', null, InputOption::VALUE_NONE, 'Show sent overdue tasks'); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $projects = array(); - $tasks = $this->taskFinder->getOverdueTasks(); - - // Group tasks by project - foreach ($tasks as $task) { - $projects[$task['project_id']][] = $task; - } - - // Send notifications for each project - foreach ($projects as $project_id => $project_tasks) { - - $users = $this->notification->getUsersList($project_id); - - $this->notification->sendEmails( - 'task_due', - $users, - array('tasks' => $project_tasks, 'project' => $project_tasks[0]['project_name']) - ); - } - - if ($input->getOption('show')) { - $this->showTable($output, $tasks); - } - } - - public function showTable(OutputInterface $output, array $tasks) - { - $rows = array(); - - foreach ($tasks as $task) { - $rows[] = array( - $task['id'], - $task['title'], - date('Y-m-d', $task['date_due']), - $task['project_id'], - $task['project_name'], - $task['assignee_name'] ?: $task['assignee_username'], - ); - } - - $table = new Table($output); - $table - ->setHeaders(array('Id', 'Title', 'Due date', 'Project Id', 'Project name', 'Assignee')) - ->setRows($rows) - ->render(); - } -} -- cgit v1.2.3