* code for task #43761.

This commit is contained in:
王怡栋
2021-11-16 17:09:15 +08:00
parent 3b4070c2f0
commit ba48e8e38f
2 changed files with 22 additions and 1 deletions
+18 -1
View File
@@ -43,7 +43,7 @@ class productEntry extends Entry
if(!$fields) return $this->send(200, $product);
/* Set other fields. */
$fields = explode(',', $fields);
$fields = explode(',', strtolower($fields));
foreach($fields as $field)
{
switch($field)
@@ -63,6 +63,23 @@ class productEntry extends Entry
$actions = $data->data->actions;
$product->actions = $this->loadModel('action')->processActionForAPI($actions, $users, $this->lang->product);
break;
case 'lastexecution':
$execution = $this->dao->select('t2.id,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.product')->eq($productID)
->andWhere('t2.type')->in('sprint,stage')
->orderBy('t2.id desc')
->limit(1)
->fetch();
if($execution)
{
$workhour = $this->loadModel('project')->computerProgress(array($execution->id => $execution));
if(isset($workhour[$execution->id])) $execution->progress = $workhour[$execution->id]->progress;
}
$product->lastExecution = $execution;
break;
}
}
+4
View File
@@ -1349,6 +1349,10 @@ class productModel extends model
$product->bugs = $bugs ? $bugs->count : 0;
$product->docs = $docs ? $docs->count : 0;
$closedTotal = $this->dao->select('count(id) AS count')->from(TABLE_STORY)->where('deleted')->eq(0)->andWhere('status')->eq('closed')->andWhere('product')->eq($productID)->fetch('count');
$allTotal = $this->dao->select('count(id) AS count')->from(TABLE_STORY)->where('deleted')->eq(0)->andWhere('product')->eq($productID)->fetch('count');
$product->progress = empty($closedTotal) ? 0 : round($closedTotal / $allTotal * 100, 1);
return $product;
}