Added new errors count to main dashboard and builds list.

This commit is contained in:
Dmitry Khomutov 2017-12-13 22:40:51 +07:00
commit ce23fac283
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
7 changed files with 76 additions and 13 deletions

View file

@ -3,6 +3,7 @@
namespace PHPCensor\Model;
use PHPCensor\Builder;
use PHPCensor\Store\BuildErrorStore;
use Symfony\Component\Yaml\Parser as YamlParser;
use PHPCensor\Model;
use b8\Store\Factory;
@ -20,12 +21,12 @@ class Build extends Model
const STAGE_FAILURE = 'failure';
const STAGE_FIXED = 'fixed';
const STAGE_BROKEN = 'broken';
const STATUS_PENDING = 0;
const STATUS_RUNNING = 1;
const STATUS_SUCCESS = 2;
const STATUS_FAILED = 3;
const SOURCE_UNKNOWN = 0;
const SOURCE_MANUAL_WEB = 1;
const SOURCE_MANUAL_CONSOLE = 2;
@ -47,6 +48,11 @@ class Build extends Model
*/
protected $modelName = 'Build';
/**
* @var integer
*/
protected $newErrorsCount = null;
/**
* @var array
*/
@ -1042,4 +1048,19 @@ OUT;
return 'source_unknown';
}
}
/**
* @return integer
*/
public function getNewErrorsCount()
{
if (null === $this->newErrorsCount) {
/** @var BuildErrorStore $store */
$store = Factory::getStore('BuildError');
$this->newErrorsCount = $store->getNewErrorsCount($this->getId());
}
return $this->newErrorsCount;
}
}