diff --git a/module/score/control.php b/module/score/control.php index 6b36a53f3d..efbf226fa7 100644 --- a/module/score/control.php +++ b/module/score/control.php @@ -39,31 +39,4 @@ class score extends control $this->display(); } - - /** - * Initialize score. - * - * @param int $lastID - * - * @access public - * @return void - */ - public function reset($lastID = 0) - { - if(helper::isAjaxRequest()) - { - $result = $this->score->reset($lastID); - if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - - if($result['status'] == 'finish') - { - return $this->send(array('result' => 'finished', 'message' => $this->lang->score->resetFinish)); - } - else - { - return $this->send(array('result' => 'unfinished', 'message' => $this->lang->score->resetLoading, 'lastID' => $result['lastID'], 'total' => $result['number'])); - } - } - $this->display(); - } } diff --git a/module/score/model.php b/module/score/model.php index 9018ed66ec..9826cdf2db 100644 --- a/module/score/model.php +++ b/module/score/model.php @@ -335,47 +335,6 @@ class scoreModel extends model return $allRules; } - /** - * Score reset. - * - * @param int $lastID - * - * @access public - * @return array - */ - public function reset($lastID = 0) - { - if($lastID == 0) - { - $this->dao->query("UPDATE " . TABLE_USER . " SET `score`=0, `scoreLevel`=0"); - $this->dao->delete()->from(TABLE_SCORE)->exec(); - try - { - $this->dbh->exec('ALTER TABLE ' . TABLE_SCORE . ' auto_increment=1'); - } - catch(Exception $e){} - } - - $actions = $this->dao->select('*')->from(TABLE_ACTION)->where('id')->gt($lastID)->orderBy('id_asc')->limit(100)->fetchAll('id'); - if(empty($actions)) return array('number' => 0, 'status' => 'finish'); - - foreach($actions as $action) - { - $param = $action->objectID; - if($action->objectType == 'execution' && $action->action == 'closed') $param = $this->dao->findById($action->objectID)->from(TABLE_PROJECT)->fetch(); - if($action->objectType == 'bug') - { - $bug = $this->dao->findById($action->objectID)->from(TABLE_BUG)->fetch(); - if(!empty($bug->case)) $action->action = 'createFormCase'; - if($action->action == 'bugconfirmed' || $action->action == 'resolved') $param = $bug; - } - if($action->objectType == 'case') $action->objectType = 'testcase'; - $this->create($action->objectType, $this->fixKey($action->action), $param, $action->actor, $action->date); - } - - return array('status' => 'more', 'lastID' => max(array_keys($actions)), 'number' => count($actions)); - } - /** * Fix action type for score. *