From 3138bfbbaf677cf78a7679a84a9c117daced7b74 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 19 Jun 2025 13:11:58 +0800 Subject: [PATCH] * [perf story #75387] Adjust for getDynamic method. --- module/action/model.php | 121 +++--------------- module/action/tao.php | 7 +- .../model/builduseraclssearchcondition.php | 46 ------- module/company/control.php | 2 +- module/company/ui/dynamic.html.php | 18 +++ module/execution/control.php | 2 +- module/execution/ui/dynamic.html.php | 1 + module/my/control.php | 2 +- module/my/ui/dynamic.html.php | 3 +- module/project/control.php | 2 +- module/project/ui/dynamic.html.php | 1 + module/user/ui/dynamic.html.php | 2 +- 12 files changed, 50 insertions(+), 157 deletions(-) delete mode 100644 module/action/test/model/builduseraclssearchcondition.php diff --git a/module/action/model.php b/module/action/model.php index 6cd9210fee..d186b072dd 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1026,11 +1026,6 @@ class actionModel extends model /* Computer the begin and end date of a period. */ $beginAndEnd = $this->computeBeginAndEnd($period, $date, $direction); - /* 构建权限搜索条件。 */ - /* Build has priv search condition. */ - $executions = array(); - $condition = !$this->app->user->admin ? $this->buildUserAclsSearchCondition($productID, $projectID, $executionID, $executions) : '1=1'; - $actionCondition = $this->getActionCondition(); if(!$actionCondition && !$this->app->user->admin && isset($this->app->user->rights['acls']['actions'])) { @@ -1038,17 +1033,14 @@ class actionModel extends model return array(); } - $condition = "`objectType` IN ('doc', 'doclib')" . ($condition == '1=1' ? '' : "OR ({$condition})") . " OR `objectType` NOT IN ('program', 'effort')"; - - $programCondition = empty($this->app->user->view->programs) ? '0' : $this->app->user->view->programs; - $condition .= " OR (`objectID` IN ($programCondition) AND `objectType` = 'program')"; + /* 构建权限搜索条件。 */ + /* Build has priv search condition. */ + $condition = "`objectType` != 'effort'"; $noMultipleExecutions = $this->dao->select('id')->from(TABLE_PROJECT)->where('multiple')->eq(0)->andWhere('type')->in('sprint,kanban')->fetchPairs(); - if($noMultipleExecutions) $condition = count($noMultipleExecutions) > 1 ? "({$condition}) AND (`objectType` != 'execution' OR (`objectID` NOT " . helper::dbIN($noMultipleExecutions) . " AND `objectType` = 'execution'))" : "({$condition}) AND (`objectType` != 'execution' OR (`objectID` NOT " . helper::dbIN($noMultipleExecutions) . " AND `objectType` = 'execution'))"; + if($noMultipleExecutions) $condition = "({$condition}) AND (`objectType` != 'execution' OR (`objectType` = 'execution' AND `objectID`" . (count($noMultipleExecutions) == 1 ? ' != ' . reset($noMultipleExecutions) : ' NOT ' . helper::dbIN($noMultipleExecutions)) . "))"; - $condition = "({$condition})"; - - $actions = $this->actionTao->getActionListByCondition($condition, $date, $beginAndEnd['begin'], $beginAndEnd['end'], $account, $productID, $projectID, $executionID, $executions, $actionCondition, $orderBy, $limit); + $actions = $this->actionTao->getActionListByCondition("({$condition})", $date, $beginAndEnd['begin'], $beginAndEnd['end'], $account, $productID, $projectID, $executionID, $actionCondition, $orderBy, $limit); if(!$actions) return array(); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'action'); @@ -1072,23 +1064,7 @@ class actionModel extends model */ public function getDynamicByProduct(int $productID, string $account = 'all', string $period = 'all', string $orderBy = 'date_desc', int $limit = 50, string $date = '', string $direction = 'next'): array { - /* 计算时间段的开始和结束时间。 */ - /* Computer the begin and end date of a period. */ - $beginAndEnd = $this->computeBeginAndEnd($period, $date, $direction); - - $actionCondition = $this->getActionCondition(); - if(!$actionCondition && !$this->app->user->admin && isset($this->app->user->rights['acls']['actions'])) - { - $this->session->set('actionQueryCondition', null, $this->app->tab); - return array(); - } - - $actions = $this->actionTao->getActionListByCondition('', $date, $beginAndEnd['begin'], $beginAndEnd['end'], $account, $productID, 'all', 'all', array(), $actionCondition, $orderBy, $limit); - if(!$actions) return array(); - - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'action'); - - return $this->transformActions($actions); + return $this->getDynamic($account, $period, $orderBy, $limit, (int)$productID, 'all', 'all', $date, $direction); } /** @@ -1107,27 +1083,7 @@ class actionModel extends model */ public function getDynamicByProject(int $projectID, string $account = 'all', string $period = 'all', string $orderBy = 'date_desc', int $limit = 50, string $date = '', string $direction = 'next'): array { - /* 计算时间段的开始和结束时间。 */ - /* Computer the begin and end date of a period. */ - $beginAndEnd = $this->computeBeginAndEnd($period, $date, $direction); - - /* 构建权限搜索条件。 */ - /* Build has priv search condition. */ - $condition = '1=1'; - - $actionCondition = $this->getActionCondition(); - if(!$actionCondition && !$this->app->user->admin && isset($this->app->user->rights['acls']['actions'])) - { - $this->session->set('actionQueryCondition', null, $this->app->tab); - return array(); - } - - $actions = $this->actionTao->getActionListByCondition($condition, $date, $beginAndEnd['begin'], $beginAndEnd['end'], $account, 'all', $projectID, 'all', array(), $actionCondition, $orderBy, $limit); - if(!$actions) return array(); - - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'action'); - - return $this->transformActions($actions); + return $this->getDynamic($account, $period, $orderBy, $limit, 'all', (int)$projectID, 'all', $date, $direction); } /** @@ -1146,27 +1102,7 @@ class actionModel extends model */ public function getDynamicByExecution(int $executionID, string $account = 'all', string $period = 'all', string $orderBy = 'date_desc', int $limit = 50, string $date = '', string $direction = 'next'): array { - /* 计算时间段的开始和结束时间。 */ - /* Computer the begin and end date of a period. */ - $beginAndEnd = $this->computeBeginAndEnd($period, $date, $direction); - - /* 构建权限搜索条件。 */ - /* Build has priv search condition. */ - $condition = '1=1'; - - $actionCondition = $this->getActionCondition(); - if(!$actionCondition && !$this->app->user->admin && isset($this->app->user->rights['acls']['actions'])) - { - $this->session->set('actionQueryCondition', null, $this->app->tab); - return array(); - } - - $actions = $this->actionTao->getActionListByCondition($condition, $date, $beginAndEnd['begin'], $beginAndEnd['end'], $account, 'all', 'all', $executionID, array(), $actionCondition, $orderBy, $limit); - if(!$actions) return array(); - - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'action'); - - return $this->transformActions($actions); + return $this->getDynamic($account, $period, $orderBy, $limit, 'all', 'all', (int)$executionID, $date, $direction); } /** @@ -1185,28 +1121,7 @@ class actionModel extends model public function getDynamicByAccount(string $account = '', string $period = 'all', string $orderBy = 'date_desc', int $limit = 50, string $date = '', string $direction = 'next'): array { if(empty($account)) $account = $this->app->user->account; - - /* 计算时间段的开始和结束时间。 */ - /* Computer the begin and end date of a period. */ - $beginAndEnd = $this->computeBeginAndEnd($period, $date, $direction); - - /* 构建权限搜索条件。 */ - /* Build has priv search condition. */ - $condition = '1=1'; - - $actionCondition = $this->getActionCondition(); - if(!$actionCondition && !$this->app->user->admin && isset($this->app->user->rights['acls']['actions'])) - { - $this->session->set('actionQueryCondition', null, $this->app->tab); - return array(); - } - - $actions = $this->actionTao->getActionListByCondition($condition, $date, $beginAndEnd['begin'], $beginAndEnd['end'], $account, 'all', 'all', 'all', array(), $actionCondition, $orderBy, $limit); - if(!$actions) return array(); - - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'action'); - - return $this->transformActions($actions); + return $this->getDynamic($account, $period, $orderBy, $limit, 'all', 'all', 'all', $date, $direction); } /** @@ -1278,7 +1193,7 @@ class actionModel extends model /* If the query condition include all executions, no limit execution. */ if(strpos($actionQuery, $allExecutions) !== false) $actionQuery = str_replace($allExecutions, '1 = 1', $actionQuery); - $actionQuery = str_replace("`product` = '{$productID}'", "`product` LIKE '%,{$productID},%'", $actionQuery); + $actionQuery = str_replace(" `product` = '{$productID}'", " t2.`product` = '{$productID}'", $actionQuery); if($date) $actionQuery = "({$actionQuery}) AND " . ('date' . ($direction == 'next' ? '<' : '>') . "'{$date}'"); /* 如果当前版本为lite,则过滤掉产品相关的动态。 */ @@ -1305,7 +1220,11 @@ class actionModel extends model public function getBySQL(string $sql, string $orderBy, int $limit = 50): array { $actionCondition = $this->getActionCondition(); - return $this->dao->select('*')->from(TABLE_ACTION) + $actionCondition = str_replace(' `action`', ' action.`action`', $actionCondition); + $hasProduct = preg_match('/ t2\.(`?)product/', $sql); + + return $this->dao->select('action.*')->from(TABLE_ACTION)->alias('action') + ->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi() ->where($sql) ->beginIF(!empty($actionCondition))->andWhere("($actionCondition)")->fi() ->orderBy($orderBy) @@ -1986,7 +1905,7 @@ class actionModel extends model $condition = $this->session->actionQueryCondition; if(empty($condition)) return false; - $hasProduct = strpos($condition, 't2.product') !== false; + $hasProduct = preg_match('/ t2\.(`?)product/', $condition); $condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition); $actions = $this->dao->select('action.id')->from(TABLE_ACTION)->alias('action') ->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi() @@ -2661,7 +2580,7 @@ class actionModel extends model if(empty($condition)) return 0; $table = $this->actionTao->getActionTable($period); - $hasProduct = strpos($condition, 't2.product') !== false; + $hasProduct = preg_match('/ t2\.(`?)product/', $condition); $actions = $this->dao->select('action.id')->from($table)->alias('action') ->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi() @@ -2716,7 +2635,7 @@ class actionModel extends model $condition = $this->session->actionQueryCondition; if(empty($condition)) return false; - $hasProduct = strpos($condition, 't2.product') !== false; + $hasProduct = preg_match('/ t2\.(`?)product/', $condition); $lastDate = substr($lastAction->originalDate, 0, 10); $condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition); $direction = stripos($this->session->actionOrderBy, ' asc') !== false ? ' > ' : ' < '; @@ -2746,9 +2665,9 @@ class actionModel extends model $condition = $this->session->actionQueryCondition; if(empty($condition)) return array(); - $hasProduct = strpos($condition, ' t2.product') !== false; + $hasProduct = preg_match('/ t2\.(`?)product/', $condition); $lastAction = $this->dao->select('*')->from(TABLE_ACTION)->where('id')->eq($lastActionID)->fetch(); - $lastDate = substr($lastAction->date, 0, 10); + $lastDate = substr($lastAction->date, 0, 10); $direction = stripos($this->session->actionOrderBy, ' asc') !== false ? ' > ' : ' < '; $actions = $this->dao->select('action.*')->from(TABLE_ACTION)->alias('action') ->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi() diff --git a/module/action/tao.php b/module/action/tao.php index 38e70280ca..ad4e2db241 100644 --- a/module/action/tao.php +++ b/module/action/tao.php @@ -686,20 +686,20 @@ class actionTao extends actionModel * @param string|int $productID * @param string|int $projectID * @param string|int $executionID - * @param array $executions * @param string $actionCondition * @param string $orderBy * @param int $limit * @access public * @return array|bool */ - public function getActionListByCondition(string $condition, string $date, string $begin, string $end, string $account, string|int $productID, string|int $projectID, string|int $executionID, array|string $executions, string $actionCondition, string $orderBy, int $limit = 50): array|bool + public function getActionListByCondition(string $condition, string $date, string $begin, string $end, string $account, string|int $productID, string|int $projectID, string|int $executionID, string $actionCondition, string $orderBy, int $limit = 50): array|bool { /* 获取最近一个月的动态用actionrecent表。 */ $lastMonth = date('Y-m-d', strtotime('-1 month')); $actionTable = ($begin >= $lastMonth && $end >= $lastMonth) ? TABLE_ACTIONRECENT : TABLE_ACTION; - $hasProduct = strpos($condition, 't2.product') !== false; + $actionCondition = str_replace(' `action`', ' action.`action`', $actionCondition); + $hasProduct = preg_match('/ t2\.(`?)product/', $condition); if(is_numeric($productID) && $productID) $hasProduct = true; if($productID === 'notzero') $hasProduct = true; @@ -713,7 +713,6 @@ class actionTao extends actionModel ->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi() ->beginIF(is_numeric($productID) && $productID)->andWhere('t2.product')->eq($productID)->fi() ->beginIF(is_numeric($projectID) && $projectID)->andWhere('project')->eq($projectID)->fi() - ->beginIF(!empty($executions))->andWhere('execution')->in(array_keys($executions))->fi() ->beginIF(is_numeric($executionID) && $executionID)->andWhere('execution')->eq($executionID)->fi() /* lite模式下需要排除的一些类型。 */ /* Types excluded from Lite. */ diff --git a/module/action/test/model/builduseraclssearchcondition.php b/module/action/test/model/builduseraclssearchcondition.php deleted file mode 100644 index 3396c0279e..0000000000 --- a/module/action/test/model/builduseraclssearchcondition.php +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env php -gen(5); -$project = zenData('project'); -$project->project->range('0-4'); -$project->parent->range('0-4'); -$project->gen(5); - -su('admin'); - -/** - -title=测试 actionModel->buildUserAclsSearchCondition(); -timeout=0 -cid=1 - -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'all', 'all', 'all' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product IN ('1','2','3','4')) OR (execution = '0' AND project != '0' AND project IN ('1','2','3','4')) OR (execution != '0' AND execution IN ('5','6','7','8')) -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'1', 'all', 'all' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '') -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'all', '1', 'all' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = 'all') OR (execution = '0' AND project = '1') OR (execution != '0' AND execution = '') -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'all', 'all', '5' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product IN ('1','2','3','4')) OR (execution = '0' AND project != '0' AND project IN ('1','2','3','4')) OR (execution != '0' AND execution = '5') -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'1', '1', 'all' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '') -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'1', 'all', '5' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '0') -- 执行actionModel模块的buildUserAclsSearchCondition方法,参数是'1', '4', '5' @((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '0') - -*/ - -global $tester, $app; -$actionModel = $tester->loadModel('action'); - -$app->user->admin = true; -$app->user->view = new stdclass(); -$app->user->view->products = '1,2,3,4'; -$app->user->view->projects = '1,2,3,4'; -$app->user->view->sprints = '5,6,7,8'; -$app->user->rights['acls'] = array(); - -$executions = array(); -r($actionModel->buildUserAclsSearchCondition('all', 'all', 'all')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product IN ('1','2','3','4')) OR (execution = '0' AND project != '0' AND project IN ('1','2','3','4')) OR (execution != '0' AND execution IN ('5','6','7','8'))"); -r($actionModel->buildUserAclsSearchCondition('1', 'all', 'all')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '')"); -r($actionModel->buildUserAclsSearchCondition('all', '1', 'all')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = 'all') OR (execution = '0' AND project = '1') OR (execution != '0' AND execution = '')"); -r($actionModel->buildUserAclsSearchCondition('all', 'all', '5')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product IN ('1','2','3','4')) OR (execution = '0' AND project != '0' AND project IN ('1','2','3','4')) OR (execution != '0' AND execution = '5')"); -r($actionModel->buildUserAclsSearchCondition('1', '1', 'all')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '')"); -r($actionModel->buildUserAclsSearchCondition('1', 'all', '5')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '0')"); -r($actionModel->buildUserAclsSearchCondition('1', '4', '5')) && p() && e("((action.product =',0,' OR action.product = '0' OR action.product=',,') AND project = '0' AND execution = '0') OR (execution = '0' AND project = '0' AND t2.product = '1') OR (execution = '0' AND project != '0' AND project = '') OR (execution != '0' AND execution = '0')"); \ No newline at end of file diff --git a/module/company/control.php b/module/company/control.php index 773c34faf1..25b9c877db 100755 --- a/module/company/control.php +++ b/module/company/control.php @@ -176,7 +176,7 @@ class company extends control /* 根据日期补充动态数据。*/ /* Supplement action by date.*/ $dateGroups = $this->action->buildDateGroup($actions, $direction, $orderBy); - if(empty($recTotal)) $recTotal = !(empty($date) && $browseType == 'all') ? array_sum(array_map('count', $dateGroups)) : $this->action->getDynamicCount(); + if(empty($recTotal) && $dateGroups) $recTotal = $this->action->getDynamicCount(); /* Assign.*/ $this->view->title = $this->lang->company->common . $this->lang->hyphen . $this->lang->company->dynamic; diff --git a/module/company/ui/dynamic.html.php b/module/company/ui/dynamic.html.php index e2640c38c8..4981723a07 100644 --- a/module/company/ui/dynamic.html.php +++ b/module/company/ui/dynamic.html.php @@ -17,6 +17,7 @@ featureBar ( set::current($browseType), set::linkParams("browseType={key}¶m={$param}&recTotal=0&date=&direction=next&userID={$userID}&productID={$productID}&projectID={$projectID}&executionID={$executionID}&orderBy={$orderBy}"), + set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'), li ( setClass('w-28 ml-4'), @@ -145,6 +146,23 @@ else ); } + global $app; + $hasMore = $app->control->loadModel('action')->hasMoreAction($lastAction); + if($hasMore) + { + $content[] = li + ( + a + ( + setID('showMoreDynamic'), + setClass('block text-center'), + setData(array('lastid' => $lastAction->id)), + set::href('###'), + on::click('showMore'), + icon('chevron-double-down') + ) + ); + } $content = ul ( setClass('timeline list-none p-0'), diff --git a/module/execution/control.php b/module/execution/control.php index 9cd628fe8a..0744ee3e95 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2620,7 +2620,7 @@ class execution extends control $date = empty($date) ? '' : date('Y-m-d', (int)$date); $actions = $this->loadModel('action')->getDynamicByExecution($executionID, $account, $period, $orderBy, 50, $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction); - if(empty($recTotal) && $dateGroups) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount(); + if(empty($recTotal) && $dateGroups) $recTotal = $this->action->getDynamicCount(); $this->view->title = $execution->name . $this->lang->hyphen . $this->lang->execution->dynamic; $this->view->userIdPairs = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted|useid'); diff --git a/module/execution/ui/dynamic.html.php b/module/execution/ui/dynamic.html.php index d40eaa7c7c..929d949c7c 100644 --- a/module/execution/ui/dynamic.html.php +++ b/module/execution/ui/dynamic.html.php @@ -16,6 +16,7 @@ featureBar ( set::current($type), set::linkParams("executionID={$executionID}&type={key}"), + set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'), li ( setClass('w-40'), diff --git a/module/my/control.php b/module/my/control.php index 78868fe455..6456ea6f1c 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1477,7 +1477,7 @@ class my extends control $date = empty($date) ? '' : date('Y-m-d', (int)$date); $actions = $this->loadModel('action')->getDynamicByAccount($this->app->user->account, $type, $orderBy, 50, $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction); - if(empty($recTotal) && $dateGroups) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount(); + if(empty($recTotal) && $dateGroups) $recTotal = $this->action->getDynamicCount(); /* Assign. */ $this->view->title = $this->lang->my->common . $this->lang->hyphen . $this->lang->my->dynamic; diff --git a/module/my/ui/dynamic.html.php b/module/my/ui/dynamic.html.php index 14cc4c4a54..75ef95b141 100644 --- a/module/my/ui/dynamic.html.php +++ b/module/my/ui/dynamic.html.php @@ -14,7 +14,8 @@ namespace zin; featureBar ( set::current($type), - set::linkParams('&type={key}') + set::linkParams('&type={key}'), + set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+') ); $content = null; diff --git a/module/project/control.php b/module/project/control.php index 5cf923a1ed..96fa0e28da 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -770,7 +770,7 @@ class project extends control $date = empty($date) ? '' : date('Y-m-d', $date); $actions = $this->loadModel('action')->getDynamicByProject($projectID, $account, $period, $orderBy, 50, $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction); - if(empty($recTotal) && $dateGroups) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount(); + if(empty($recTotal) && $dateGroups) $recTotal = $this->action->getDynamicCount(); /* The header and position. */ $project = $this->project->getByID($projectID); diff --git a/module/project/ui/dynamic.html.php b/module/project/ui/dynamic.html.php index b595339cf9..e4927cc43e 100644 --- a/module/project/ui/dynamic.html.php +++ b/module/project/ui/dynamic.html.php @@ -16,6 +16,7 @@ featureBar ( set::current($type), set::linkParams("projectID={$projectID}&type={key}"), + set::labelCount($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'), li ( setClass('w-40'), diff --git a/module/user/ui/dynamic.html.php b/module/user/ui/dynamic.html.php index eed4f9de94..2f9a9312f0 100644 --- a/module/user/ui/dynamic.html.php +++ b/module/user/ui/dynamic.html.php @@ -17,7 +17,7 @@ $dynamicNavs = array(); foreach($lang->user->featureBar['dynamic'] as $key => $label) $dynamicNavs[$key] = array('text' => $label, 'url' => inlink('dynamic', "userID={$user->id}&period={$key}")); if(isset($dynamicNavs[$period])) { - if(!empty($recTotal)) $dynamicNavs[$period]['badge'] = array('text' => $recTotal, 'class' => 'size-sm canvas ring-0 rounded-md'); + if(!empty($recTotal)) $dynamicNavs[$period]['badge'] = array('text' => ($recTotal < \actionModel::MAXCOUNT ? $recTotal : (\actionModel::MAXCOUNT - 1) . '+'), 'class' => 'size-sm canvas ring-0 rounded-md'); $dynamicNavs[$period]['active'] = true; }