From 6831273863d2fb0f0447707a06080fa22e9d684d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 18 Jun 2025 16:20:07 +0800 Subject: [PATCH] * [perf story #75383] Adjust my dynamic page. --- module/action/model.php | 2 +- module/my/control.php | 37 ++--------------------------------- module/my/ui/dynamic.html.php | 21 ++++++++++++++++++-- 3 files changed, 22 insertions(+), 38 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index a93e5a4860..9530c180a2 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -2680,7 +2680,7 @@ class actionModel extends model ->where($condition) ->andWhere("`date`")->ge($lastDate) ->andWhere("`date`")->lt($lastDate . ' 23:59:59') - ->andWhere('action.id' . $direction . $lastActionID) + ->andWhere("`date` {$direction} '{$lastAction->date}'") ->orderBy($this->session->actionOrderBy) ->limit($limit) ->fetchAll('id', false); diff --git a/module/my/control.php b/module/my/control.php index f0506a36f4..78868fe455 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1472,45 +1472,12 @@ class my extends control */ public function dynamic(string $type = 'today', int $recTotal = 0, string $date = '', string $direction = 'next') { - /* Save session. */ - $uri = $this->app->getURI(true); - $this->session->set('productList', $uri, 'product'); - $this->session->set('storyList', $uri, 'product'); - $this->session->set('designList', $uri, 'project'); - $this->session->set('productPlanList', $uri, 'product'); - $this->session->set('releaseList', $uri, 'product'); - $this->session->set('projectList', $uri, 'project'); - $this->session->set('executionList', $uri, 'execution'); - $this->session->set('taskList', $uri, 'execution'); - $this->session->set('buildList', $uri, 'execution'); - $this->session->set('bugList', $uri, 'qa'); - $this->session->set('caseList', $uri, 'qa'); - $this->session->set('caselibList', $uri, 'qa'); - $this->session->set('testsuiteList', $uri, 'qa'); - $this->session->set('testtaskList', $uri, 'qa'); - $this->session->set('reportList', $uri, 'qa'); - $this->session->set('docList', $uri, 'doc'); - $this->session->set('todoList', $uri, 'my'); - $this->session->set('riskList', $uri, 'project'); - $this->session->set('issueList', $uri, 'project'); - $this->session->set('stakeholderList', $uri, 'project'); - $this->session->set('meetingroomList', $uri, 'admin'); - $this->session->set('meetingList', $uri, 'project'); - $this->session->set('meetingList', $uri, 'assetlib'); - $this->session->set('storyLibList', $uri, 'assetlib'); - $this->session->set('issueLibList', $uri, 'assetlib'); - $this->session->set('riskLibList', $uri, 'assetlib'); - $this->session->set('opportunityLibList', $uri, 'assetlib'); - $this->session->set('practiceLibList', $uri, 'assetlib'); - $this->session->set('componentLibList', $uri, 'assetlib'); - $this->session->set('opportunityList', $uri, 'project'); - /* Append id for second sort. */ $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc'; $date = empty($date) ? '' : date('Y-m-d', (int)$date); - $actions = $this->loadModel('action')->getDynamic($this->app->user->account, $type, $orderBy, 50, 'all', 'all', 'all', $date, $direction); + $actions = $this->loadModel('action')->getDynamicByAccount($this->app->user->account, $type, $orderBy, 50, $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction); - if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount(); + if(empty($recTotal) && $dateGroups) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $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 fa02179e8a..14cc4c4a54 100644 --- a/module/my/ui/dynamic.html.php +++ b/module/my/ui/dynamic.html.php @@ -37,7 +37,8 @@ else $lastAction = ''; foreach($dateGroups as $date => $actions) { - $isToday = date(DT_DATE3) == $date; + $lastAction = end($actions); + $isToday = date(DT_DATE3) == $date; if(empty($firstAction)) $firstAction = reset($actions); $content[] = li ( @@ -70,9 +71,25 @@ else ) ) ); - $lastAction = end($actions); } + 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 pl-0'),