diff options
| author | Frederic Guillot <fred@kanboard.net> | 2016-05-28 19:48:22 -0400 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2016-05-28 19:48:22 -0400 |
| commit | 14713b0ec7ed93ca45578da069ad4e19a7d8addf (patch) | |
| tree | 79972d53f6091a1ddb17f64a6a05a5523f5d5168 /app/Model/ProjectDailyStats.php | |
| parent | 936376ffe74c583d3cb819e98f53a85137fdf8bc (diff) | |
Rename all models
Diffstat (limited to 'app/Model/ProjectDailyStats.php')
| -rw-r--r-- | app/Model/ProjectDailyStats.php | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/app/Model/ProjectDailyStats.php b/app/Model/ProjectDailyStats.php deleted file mode 100644 index 08a0039e..00000000 --- a/app/Model/ProjectDailyStats.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -namespace Kanboard\Model; - -use Kanboard\Core\Base; - -/** - * Project Daily Stats - * - * @package model - * @author Frederic Guillot - */ -class ProjectDailyStats extends Base -{ - /** - * SQL table name - * - * @var string - */ - const TABLE = 'project_daily_stats'; - - /** - * Update daily totals for the project - * - * @access public - * @param integer $project_id Project id - * @param string $date Record date (YYYY-MM-DD) - * @return boolean - */ - public function updateTotals($project_id, $date) - { - $this->db->startTransaction(); - - $lead_cycle_time = $this->averageLeadCycleTimeAnalytic->build($project_id); - - $this->db->table(self::TABLE)->eq('day', $date)->eq('project_id', $project_id)->remove(); - - $this->db->table(self::TABLE)->insert(array( - 'day' => $date, - 'project_id' => $project_id, - 'avg_lead_time' => $lead_cycle_time['avg_lead_time'], - 'avg_cycle_time' => $lead_cycle_time['avg_cycle_time'], - )); - - $this->db->closeTransaction(); - - return true; - } - - /** - * Get raw metrics for the project within a data range - * - * @access public - * @param integer $project_id Project id - * @param string $from Start date (ISO format YYYY-MM-DD) - * @param string $to End date - * @return array - */ - public function getRawMetrics($project_id, $from, $to) - { - $metrics = $this->db->table(self::TABLE) - ->columns('day', 'avg_lead_time', 'avg_cycle_time') - ->eq('project_id', $project_id) - ->gte('day', $from) - ->lte('day', $to) - ->asc('day') - ->findAll(); - - foreach ($metrics as &$metric) { - $metric['avg_lead_time'] = (int) $metric['avg_lead_time']; - $metric['avg_cycle_time'] = (int) $metric['avg_cycle_time']; - } - - return $metrics; - } -} |
