* Add statistic data about release and bug to productModel class.
This commit is contained in:
@@ -1169,8 +1169,10 @@ class productModel extends model
|
||||
$unclosedStory = $this->story->getUnClosedTotal();
|
||||
$plans = $this->productTao->getPlansTODO($productIdList);
|
||||
$releases = $this->productTao->getReleasesTODO($productIdList);
|
||||
$latestReleases = $this->productTao->getLatestReleasesTODO($productIdList);
|
||||
$bugs = $this->productTao->getBugsTODO($productIdList);
|
||||
$unResolved = $this->productTao->getUnResolvedTODO($productIdList);
|
||||
$activeBugs = $this->productTao->getActiveBugsTODO($productIdList);
|
||||
$fixedBugs = $this->productTao->getFixedBugsTODO($productIdList);
|
||||
$closedBugs = $this->productTao->getClosedBugsTODO($productIdList);
|
||||
$thisWeekBugs = $this->productTao->getThisWeekBugsTODO($productIdList);
|
||||
@@ -1192,6 +1194,7 @@ class productModel extends model
|
||||
$product->releases = isset($releases[$product->id]) ? $releases[$product->id] : 0;
|
||||
$product->bugs = isset($bugs[$product->id]) ? $bugs[$product->id] : 0;
|
||||
$product->unResolved = isset($unResolved[$product->id]) ? $unResolved[$product->id] : 0;
|
||||
$product->activeBugs = isset($activeBugs[$product->id]) ? $activeBugs[$product->id] : 0;
|
||||
$product->closedBugs = isset($closedBugs[$product->id]) ? $closedBugs[$product->id] : 0;
|
||||
$product->fixedBugs = isset($fixedBugs[$product->id]) ? $fixedBugs[$product->id] : 0;
|
||||
$product->thisWeekBugs = isset($thisWeekBugs[$product->id]) ? $thisWeekBugs[$product->id] : 0;
|
||||
@@ -1199,6 +1202,10 @@ class productModel extends model
|
||||
$product->executions = isset($executionCountPairs[$product->id]) ? $executionCountPairs[$product->id] : 0;
|
||||
$product->coverage = isset($coveragePairs[$product->id]) ? $coveragePairs[$product->id] : 0;
|
||||
|
||||
$latestRelease = isset($latestReleases[$product->id]) ? $latestReleases[$product->id][0] : null;
|
||||
$product->latestRelease = $latestRelease ? $latestRelease->name : '';
|
||||
$product->latestReleaseDate = $latestRelease ? $latestRelease->date : '';
|
||||
|
||||
/* Calculate product progress. */
|
||||
$closedTotal = $product->stories['closed'] + $product->requirements['closed'];
|
||||
$allTotal = array_sum($product->stories) + array_sum($product->requirements);
|
||||
|
||||
+31
-2
@@ -291,6 +291,17 @@ class productTao extends productModel
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/* TODO move to release module. */
|
||||
protected function getLatestReleasesTODO(array $productIDs): array
|
||||
{
|
||||
return $this->dao->select('product, name, date')
|
||||
->from(TABLE_RELEASE)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('product')->in($productIDs)
|
||||
->orderBy('id_desc')
|
||||
->fetchGroup('product');
|
||||
}
|
||||
|
||||
/* TODO move to bug module. */
|
||||
protected function getBugsTODO(array $productIDs): array
|
||||
{
|
||||
@@ -315,6 +326,18 @@ class productTao extends productModel
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/* TODO move to bug module. */
|
||||
protected function getActiveBugsTODO(array $productIDs): array
|
||||
{
|
||||
return $this->dao->select('product,count(*) AS count')
|
||||
->from(TABLE_BUG)
|
||||
->where('status')->eq('active')
|
||||
->andWhere('product')->in($productIDs)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->groupBy('product')
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/* TODO move to bug module. */
|
||||
protected function getFixedBugsTODO(array $productIDs): array
|
||||
{
|
||||
@@ -381,8 +404,14 @@ class productTao extends productModel
|
||||
{
|
||||
$this->loadModel('program');
|
||||
|
||||
if($orderBy == 'program_asc') $products = $this->getPagerProductsWithProgramIn($productIdList, $pager);
|
||||
else $products = $this->getPagerProductsIn($productIdList, $pager, $orderBy);
|
||||
if($orderBy == 'program_asc')
|
||||
{
|
||||
$products = $this->getPagerProductsWithProgramIn($productIdList, $pager);
|
||||
}
|
||||
else
|
||||
{
|
||||
$products = $this->getPagerProductsIn($productIdList, $pager, $orderBy);
|
||||
}
|
||||
|
||||
/* Fetch product lines. */
|
||||
$linePairs = $this->getLinePairs();
|
||||
|
||||
Reference in New Issue
Block a user