* Merge code from 18x.
This commit is contained in:
@@ -26,9 +26,14 @@ class case_coverage_of_projected_story_in_product extends baseCalc
|
||||
|
||||
public function getStatement()
|
||||
{
|
||||
return $this->dao->select('t1.product, COUNT(t1.id) as total, SUM(IF(t3.id IS NULL, 0, 1)) as hasCase')->from(TABLE_STORY)->alias('t1')
|
||||
$caseQuery = $this->dao->select('story, count(DISTINCT id) as case_count')->from(TABLE_CASE)
|
||||
->groupBy('story')
|
||||
->get();
|
||||
|
||||
return $this->dao->select('t1.product, COUNT(t1.id) as total, SUM(CASE WHEN t3.case_count > 0 THEN 1 ELSE 0 END) as hasCase')->from(TABLE_STORY)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
|
||||
->leftJoin(TABLE_CASE)->alias('t3')->on('t1.id=t3.story')
|
||||
->leftJoin("($caseQuery)")->alias('t3')->on('t1.id=t3.story')
|
||||
->where('t1.stage')->eq('projected')
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
|
||||
Reference in New Issue
Block a user