summaryrefslogtreecommitdiff
path: root/app/Job/ProjectMetricJob.php
blob: 6330bd4cd64241093fc7c1129a0474678fd27291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

namespace Kanboard\Job;

/**
 * Class ProjectMetricJob
 *
 * @package Kanboard\Job
 * @author  Frederic Guillot
 */
class ProjectMetricJob extends BaseJob
{
    /**
     * Set job parameters
     *
     * @access public
     * @param  integer $projectId
     * @return $this
     */
    public function withParams($projectId)
    {
        $this->jobParams = array($projectId);
        return $this;
    }

    /**
     * Execute job
     *
     * @access public
     * @param  integer $projectId
     */
    public function execute($projectId)
    {
        $this->logger->debug(__METHOD__.' Run project metrics calculation');
        $now = date('Y-m-d');

        $this->projectDailyColumnStatsModel->updateTotals($projectId, $now);
        $this->projectDailyStatsModel->updateTotals($projectId, $now);
    }
}