* Finish task #56383.

This commit is contained in:
zhouxudong
2022-06-08 09:37:10 +00:00
parent 0dc3a87d2e
commit 6265fcd76f
2 changed files with 9 additions and 20 deletions
+7 -12
View File
@@ -3414,34 +3414,29 @@ class kanbanModel extends model
*/
public function getGroupBySpaceList($spaceIdList, $kanbanIdList = '')
{
$kanbanList = $this->dao->select('*')->from(TABLE_KANBAN)
$spaceList = $this->dao->select('*')->from(TABLE_KANBAN)
->where('deleted')->eq(0)
->andWhere('space')->in($spaceIdList)
->beginIF($kanbanIdList)->andWhere('id')->in($kanbanIdList)->fi()
->fetchGroup('space', 'id');
$kanbanIDList = array();
foreach($kanbanList as $kanbanPairs)
{
foreach($kanbanPairs as $kanban)
{
$kanbanIDList[$kanban->id] = $kanban->id;
}
}
foreach($spaceList as $kanbanList) $kanbanIDList = array_merge_recursive($kanbanIDList, array_keys($kanbanList));
$cardsCount = $this->dao->select('kanban, COUNT(*) as count')->from(TABLE_KANBANCARD)
->where('deleted')->eq(0)
->andWhere('kanban')->in($kanbanIDList)
->groupBy('kanban')
->fetchPairs('kanban');
foreach($kanbanList as $kanbanPairs)
foreach($spaceList as $kanbanList)
{
foreach($kanbanPairs as $kanban)
foreach($kanbanList as $kanban)
{
if(isset($cardsCount[$kanban->id])) $kanban->cardsCount = $cardsCount[$kanban->id];
$kanban->cardsCount = zget($cardsCount, $kanban->id, 0);
}
}
return $kanbanList;
return $spaceList;
}
/**
+2 -8
View File
@@ -153,14 +153,8 @@
</div>
<?php endif;?>
<div class='kanban-members-total pull-left'><?php echo sprintf($lang->kanban->teamSumCount, $teamCount);?></div>
<?php
$cardsCount = $lang->kanban->cardsCount;
if($kanban->cardsCount > 1)
{
$cardsCount = str_replace("card", "cards", $cardsCount);
}
?>
<div class='kanban-members-total pull-right'><?php echo empty($kanban->cardsCount) ? $lang->kanban->noCard : sprintf($cardsCount, $kanban->cardsCount)?></div>
<?php $cardsCount = ($kanban->cardsCount > 1) ? str_replace("card", "cards", $lang->kanban->cardsCount) : $lang->kanban->cardsCount;?>
<div class='kanban-members-total pull-right'><?php echo empty($kanban->cardsCount) ? $lang->kanban->noCard : sprintf($cardsCount, $kanban->cardsCount);?></div>
</div>
</div>
</div>