* Optimize code.
This commit is contained in:
@@ -542,7 +542,14 @@ class build extends control
|
||||
public function ajaxGetLastBuild($projectID, $executionID)
|
||||
{
|
||||
$lastBuild = $this->build->getLast($executionID, $projectID);
|
||||
echo "<div class='help-block'> " . $this->lang->build->last . ": <a class='code label label-badge label-light' id='lastBuildBtn'>" . $lastBuild->name . "</a></div>";
|
||||
if($lastBuild)
|
||||
{
|
||||
echo "<div class='help-block'> " . $this->lang->build->last . ": <a class='code label label-badge label-light' id='lastBuildBtn'>" . $lastBuild->name . "</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ $().ready(function()
|
||||
{
|
||||
var productID = $('#product').val();
|
||||
var branch = $('#branch').length > 0 ? $('#branch').val() : '';
|
||||
$.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,singled&extra=multiple'), function(data)
|
||||
$.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + window.projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,singled&extra=multiple'), function(data)
|
||||
{
|
||||
if(data) $('#buildBox').html(data);
|
||||
$('#builds').attr('data-placeholder', multipleSelect).chosen();
|
||||
@@ -78,10 +78,11 @@ function loadProducts(executionID)
|
||||
function loadLastBuild()
|
||||
{
|
||||
var isIntegrated = $('input[name=isIntegrated]:checked').val();
|
||||
var projectID = $('#project').val();
|
||||
var executionID = $('#execution').val();
|
||||
if(isIntegrated == 'yes') executionID = 0;
|
||||
$.get(createLink('build', 'ajaxGetLastBuild', 'projectID=' + projectID + '&executionID=' + executionID), function(data)
|
||||
{
|
||||
if(data) $('#lastBuildBox').html(data);
|
||||
$('#lastBuildBox').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ class buildModel extends model
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_BUILD)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($executionID)->andWhere('execution')->eq((int)$executionID)->fi()
|
||||
->andWhere('execution')->eq((int)$executionID)
|
||||
->beginIF($projectID)->andWhere('project')->eq((int)$projectID)->fi()
|
||||
->orderBy('date DESC,id DESC')
|
||||
->limit(1)
|
||||
|
||||
Reference in New Issue
Block a user