* Refactor hasUnfinished method.

This commit is contained in:
tianshujie
2023-09-14 11:01:04 +08:00
parent 27867472ab
commit 91e26c2ba0
3 changed files with 13 additions and 21 deletions
+3 -2
View File
@@ -1231,15 +1231,16 @@ class programModel extends model
}
/**
* 该项目集下未关闭的子项目集或项目的数量。
* Judge whether there is an unclosed programs or projects.
*
* @param object $program
* @access public
* @return int
*/
public function hasUnfinished($program)
public function hasUnfinished(object $program): int
{
return $this->dao->select("count(IF(id != {$program->id}, 1, null)) as count")->from(TABLE_PROJECT)
return $this->dao->select("count(IF(id != {$program->id}, 1, 0)) as count")->from(TABLE_PROJECT)
->where('type')->in('program, project')
->andWhere('path')->like($program->path . '%')
->andWhere('status')->ne('closed')