From 5a3ea1e897e76b8fd2a455af02e8f4c4afecbb8c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 9 Mar 2020 17:42:43 +0800 Subject: [PATCH] * adjust for parseComment. --- module/ci/model.php | 1 + module/git/model.php | 2 +- module/repo/model.php | 40 +++++++++++++++++++--------------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/module/ci/model.php b/module/ci/model.php index c28314a532..ed93df153d 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -37,6 +37,7 @@ class ciModel extends model ->leftJoin(TABLE_JENKINS)->alias('t3')->on('t2.jkHost=t3.id') ->where('t1.status')->ne('success') ->andWhere('t1.status')->ne('fail') + ->andWhere('t1.status')->ne('create_fail') ->andWhere('t1.status')->ne('timeout') ->andWhere('t1.createdDate')->gt(date(DT_DATETIME1, strtotime("-1 day"))) ->fetchAll(); diff --git a/module/git/model.php b/module/git/model.php index fd53ee1389..8159a23d28 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -119,7 +119,7 @@ class gitModel extends model if($objects) { $this->printLog('extract' . - 'task:' . join(' ', $objects['tasks']) . + ' task:' . join(' ', $objects['tasks']) . ' bug:' . join(',', $objects['bugs'])); $this->repo->saveAction2PMS($objects, $log, $this->repoRoot, $repo->encoding, 'git'); diff --git a/module/repo/model.php b/module/repo/model.php index 7de20d0c1d..e53bf2f761 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -1166,9 +1166,9 @@ class repoModel extends model $costReg = "($costs) *(($costMarks)([0-9]+)($costUnit))"; $leftReg = "($lefts) *(($leftMarks)([0-9]+)($leftUnit))"; - $startTaskReg = "({$startAction}) *{$taskReg} +$costReg +$leftReg"; - $effortTaskReg = "({$effortAction}) *{$taskReg} +$costReg +$leftReg"; - $finishTaskReg = "({$finishAction}) *{$taskReg} +$costReg"; + $startTaskReg = "({$startAction}) *{$taskReg}.*$costReg.*$leftReg"; + $effortTaskReg = "({$effortAction}) *{$taskReg}.*$costReg.*$leftReg"; + $finishTaskReg = "({$finishAction}) *{$taskReg}.*$costReg"; $resolveBugReg = "({$resolveAction}) *{$bugReg}"; $reg = array(); @@ -1249,7 +1249,10 @@ class repoModel extends model } elseif($taskAction == 'finish') { + $task = $this->task->getById($taskID); $this->post->set('finishedDate', date('Y-m-d')); + $this->post->set('currentConsumed', $this->post->consumed); + $this->post->set('consumed', $this->post->consumed + $task->consumed); $changes = $this->task->finish($taskID); if($changes) { @@ -1258,7 +1261,7 @@ class repoModel extends model } } } - unset($object['tasks'][$taskID]); + unset($objects['tasks'][$taskID]); } } if(isset($actions['bug'])) @@ -1285,7 +1288,7 @@ class repoModel extends model } } } - unset($object['bugs'][$bugID]); + unset($objects['bugs'][$bugID]); } } @@ -1350,15 +1353,9 @@ class repoModel extends model $this->dao->update(TABLE_ACTION)->data($action)->where('id')->eq($record->id)->exec(); if($changes) { - $historyID = $this->dao->findByAction($record->id)->from(TABLE_HISTORY)->fetch('id'); - if($historyID) - { - $this->dao->update(TABLE_HISTORY)->data($changes)->where('id')->eq($historyID)->exec(); - } - else - { - $this->action->logHistory($record->id, array($changes)); - } + $historyIdList = $this->dao->findByAction($record->id)->from(TABLE_HISTORY)->fetchPairs('id', 'id'); + if($historyIdList) $this->dao->delete()->from(TABLE_HISTORY)->where('id')->in($historyIdList)->exec(); + $this->action->logHistory($record->id, $changes); } } else @@ -1367,7 +1364,7 @@ class repoModel extends model if($changes) { $actionID = $this->dao->lastInsertID(); - $this->action->logHistory($actionID, array($changes)); + $this->action->logHistory($actionID, $changes); } } } @@ -1400,14 +1397,15 @@ class repoModel extends model $diff .= $action == 'M' ? "$diffLink\n" : "\n" ; } } - $changes = new stdclass(); - $changes->field = $scm == 'svn' ? 'subversion' : 'git'; - $changes->old = ''; - $changes->new = ''; - $changes->diff = trim($diff); + $change = new stdclass(); + $change->field = $scm == 'svn' ? 'subversion' : 'git'; + $change->old = ''; + $change->new = ''; + $change->diff = trim($diff); + $changes[] = $change; $this->server->set('PHP_SELF', $oldSelf); - return (array)$changes; + return $changes; } /**