Fix task counter query
Was doing wrong count when multiple projects were involved. Also pagination was not ignored as it should have. This technically increases load on the database, so maybe we need to upgrade server to handle real thing we want to be displayed.
This commit is contained in:
@@ -239,7 +239,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||
|
||||
protected function buildTaskCountSelectClause(AphrontDatabaseConnection $conn) {
|
||||
$parts = $this->buildSelectClauseParts($conn);
|
||||
$parts[] = qsprintf($conn, 'COUNT(`task`.id) as count');
|
||||
$parts[0] = qsprintf($conn, '`task`.id');
|
||||
return $this->formatSelectClause($conn, $parts);
|
||||
}
|
||||
|
||||
@@ -259,16 +259,18 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||
}
|
||||
|
||||
if ($count_all_tasks) {
|
||||
return queryfx_one(
|
||||
$r = queryfx_all(
|
||||
$conn,
|
||||
'%Q FROM %T task %Q %Q %Q %Q %Q',
|
||||
'%Q %Q FROM %T task %Q %Q %Q %Q %Q',
|
||||
$this->buildTaskCountSelectClause($conn),
|
||||
$group_column,
|
||||
$task_dao->getTableName(),
|
||||
$this->buildJoinClause($conn),
|
||||
$where,
|
||||
$this->buildGroupClause($conn),
|
||||
$this->buildHavingClause($conn),
|
||||
$this->buildOrderClause($conn),
|
||||
$this->buildLimitClause($conn));
|
||||
$this->buildOrderClause($conn));
|
||||
return array('count' => count($r));
|
||||
} else {
|
||||
return queryfx_all(
|
||||
$conn,
|
||||
|
||||
Reference in New Issue
Block a user