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

@ -143,6 +143,7 @@ class BuildErrorStore extends Store
* @param integer $buildId
* @param string $plugin
* @param integer $severity
* @param string $isNew
*
* @return integer
*/
@ -295,4 +296,26 @@ class BuildErrorStore extends Store
return true;
}
/**
* @param integer $buildId
*
* @return integer
*/
public function getNewErrorsCount($buildId)
{
$query = 'SELECT COUNT(*) AS {{total}} FROM {{build_error}} WHERE {{build_id}} = :build AND {{is_new}} = true';
$stmt = Database::getConnection('read')->prepareCommon($query);
$stmt->bindValue(':build', $buildId);
if ($stmt->execute()) {
$res = $stmt->fetch(\PDO::FETCH_ASSOC);
return (integer)$res['total'];
}
return 0;
}
}