Added a fixed and broken stage
This commit is contained in:
parent
efbd68a870
commit
c42d2f3dad
3 changed files with 46 additions and 3 deletions
|
|
@ -50,6 +50,29 @@ class Project extends ProjectBase
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the previous build from a specific branch, for this project.
|
||||
* @param string $branch
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getPreviousBuild($branch = 'master')
|
||||
{
|
||||
$criteria = array('branch' => $branch, 'project_id' => $this->getId());
|
||||
|
||||
$order = array('id' => 'DESC');
|
||||
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, array(), $order);
|
||||
|
||||
if (is_array($builds['items']) && count($builds['items'])) {
|
||||
$previous = array_shift($builds['items']);
|
||||
|
||||
if (isset($previous) && $previous instanceof Build) {
|
||||
return $previous;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store this project's access_information data
|
||||
* @param string|array $value
|
||||
|
|
@ -131,4 +154,4 @@ class Project extends ProjectBase
|
|||
|
||||
return $icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue