From 92f44d38bad2f6b827da786aa94526e255d682f1 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 31 Aug 2023 10:14:19 +0800 Subject: [PATCH] * Refactor computeCFD method. --- module/execution/control.php | 9 +++++---- module/execution/model.php | 20 +++----------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 2f23a80aeb..bb06f63c2a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1335,7 +1335,7 @@ class execution extends control /** * 更新燃尽图数据。 - * Compute burndown datas. + * Compute burndown data. * * @param string $reload * @access public @@ -1414,17 +1414,18 @@ class execution extends control } /** - * Compute cfd datas. + * 计算累计流图数据。 + * Compute cfd data. * * @param string $reload * @param int $executionID * @access public * @return void */ - public function computeCFD($reload = 'no', $executionID = 0) + public function computeCFD(string $reload = 'no', int $executionID = 0) { $this->execution->computeCFD($executionID); - if($reload == 'yes') return print(js::reload('parent')); + if($reload == 'yes') return $this->sendSuccess(array('load' => true)); } /** diff --git a/module/execution/model.php b/module/execution/model.php index fafc33adaf..d91de60ba1 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3809,13 +3809,14 @@ class executionModel extends model } /** + * 计算累计流图的数据。 * Compute cfd of a execution. * * @param int $executionID * @access public * @return array */ - public function computeCFD($executionID = 0) + public function computeCFD(int $executionID = 0) { $today = helper::today(); $executions = $this->dao->select('id, code')->from(TABLE_EXECUTION) @@ -3856,22 +3857,7 @@ class executionModel extends model { foreach($columns as $colName => $laneGroup) { - $cfd = new stdclass(); - $cfd->count = 0; - $cfd->date = $today; - $cfd->type = $type; - foreach($laneGroup as $columnGroup) - { - foreach($columnGroup as $columnCard) - { - $cards = trim($columnCard->cards, ','); - $cfd->count += $cards ? count(explode(',', $cards)) : 0; - } - } - - $cfd->name = $colName; - $cfd->execution = $executionID; - $this->dao->replace(TABLE_CFD)->data($cfd)->exec(); + $this->executionTao->updateTodayCFDData($executionID, $type, $colName, $laneGroup); } } }