* product: refactor getStoryCasesCount function.
This commit is contained in:
@@ -1517,7 +1517,7 @@ class productModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
$casesCount = $this->productTao->getStoriesInCasesCount($storyIdList);
|
||||
$casesCount = $this->productTao->getStoryCasesCount($storyIdList);
|
||||
$rate = count($stories) == 0 || $rateCount == 0 ? 0 : round($casesCount / $rateCount, 2);
|
||||
|
||||
$storyCommon = $this->lang->SRCommon;
|
||||
|
||||
@@ -637,13 +637,11 @@ class productTao extends productModel
|
||||
* @access protected
|
||||
* @return int
|
||||
*/
|
||||
protected function getStoriesInCasesCount(array $storyIdList): int
|
||||
protected function getStoryCasesCount(array $storyIdList): int
|
||||
{
|
||||
if(empty($storyIdList)) return 0;
|
||||
|
||||
$cases = $this->dao->select('story')->from(TABLE_CASE)->where('story')->in($storyIdList)->andWhere('deleted')->eq(0)->fetchAll('story');
|
||||
|
||||
return count($cases);
|
||||
return $this->dao->select('COUNT(story) AS count')->from(TABLE_CASE)->where('story')->in($storyIdList)->andWhere('deleted')->eq('0')->fetch('count');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user