* adjust the code and delete useless code
This commit is contained in:
+36
-34
@@ -187,7 +187,7 @@ class storyModel extends model
|
||||
return common::createChanges($oldStory, $story);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a story.
|
||||
*
|
||||
@@ -228,7 +228,7 @@ class storyModel extends model
|
||||
->where('id')->eq((int)$storyID)->exec();
|
||||
if(!dao::isError()) return common::createChanges($oldStory, $story);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Review a story.
|
||||
*
|
||||
@@ -279,7 +279,7 @@ class storyModel extends model
|
||||
$this->setStage($storyID);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close a story.
|
||||
*
|
||||
@@ -489,6 +489,10 @@ class storyModel extends model
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchGroup('plan');
|
||||
|
||||
/* Set session for report query. */
|
||||
$this->session->set('reportQuery', $this->dao->get());
|
||||
|
||||
if(!$tmpStories) return array();
|
||||
$plans = $this->dao->select('id,title')->from(TABLE_PRODUCTPLAN)->where('id')->in(array_keys($tmpStories))->fetchPairs();
|
||||
$stories = array();
|
||||
@@ -705,6 +709,7 @@ class storyModel extends model
|
||||
if(!empty($story->lastEditedBy)) $accounts[] = $story->lastEditedBy;
|
||||
return array_unique($accounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the default chart settings and the settings of current chart.
|
||||
*
|
||||
@@ -722,7 +727,6 @@ class storyModel extends model
|
||||
if(!isset($chartOption->width)) $chartOption->width = $commonOption->width;
|
||||
if(!isset($chartOption->height)) $chartOption->height = $commonOption->height;
|
||||
|
||||
/* 合并配置。*/
|
||||
foreach($commonOption->graph as $key => $value) if(!isset($chartOption->graph->$key)) $chartOption->graph->$key = $value;
|
||||
}
|
||||
|
||||
@@ -735,8 +739,7 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerProduct()
|
||||
{
|
||||
$datas = $this->dao->select('product as name, count(product) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('product')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
@@ -744,7 +747,7 @@ class storyModel extends model
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get report data of storys per module
|
||||
*
|
||||
* @access public
|
||||
@@ -753,14 +756,14 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerModule()
|
||||
{
|
||||
$datas = $this->dao->select('module as name, count(module) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('module')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
$modules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(array_keys($datas))->fetchPairs();
|
||||
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report data of storys per plan
|
||||
*
|
||||
@@ -770,15 +773,15 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerPlan()
|
||||
{
|
||||
$datas = $this->dao->select('plan as name, count(plan) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('plan')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
$plans = $this->dao->select('id, title')->from(TABLE_PRODUCTPLAN)->where('id')->in(array_keys($datas))->fetchPairs();
|
||||
foreach($datas as $planID => $data) $data->name = isset($plans[$planID]) ? $plans[$planID] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per status
|
||||
*
|
||||
* @access public
|
||||
@@ -787,14 +790,14 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerStatus()
|
||||
{
|
||||
$datas = $this->dao->select('status as name, count(status) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('status')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
foreach($datas as $status => $data) if(isset($this->lang->story->statusList[$status])) $data->name = $this->lang->story->statusList[$status];
|
||||
return $datas;
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per stage
|
||||
*
|
||||
* @access public
|
||||
@@ -803,13 +806,13 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerStage()
|
||||
{
|
||||
$datas = $this->dao->select('stage as name, count(stage) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('stage')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
foreach($datas as $stage => $data) $data->name = $this->lang->story->stageList[$stage] != '' ? $this->lang->story->stageList[$stage] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report data of storys per pri
|
||||
*
|
||||
@@ -819,14 +822,14 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerPri()
|
||||
{
|
||||
$datas = $this->dao->select('pri as name, count(pri) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('pri')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
foreach($datas as $pri => $data) $data->name = $this->lang->story->priList[$pri] != '' ? $this->lang->story->priList[$pri] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per estimate
|
||||
*
|
||||
* @access public
|
||||
@@ -835,11 +838,11 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerEstimate()
|
||||
{
|
||||
return $this->dao->select('estimate as name, count(estimate) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('estimate')->orderBy('value')->fetchAll();
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per openedBy
|
||||
*
|
||||
* @access public
|
||||
@@ -848,15 +851,15 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerOpenedBy()
|
||||
{
|
||||
$datas = $this->dao->select('openedBy as name, count(openedBy) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('openedBy')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
if(!isset($this->users)) $this->users = $this->loadModel('user')->getPairs('noletter');
|
||||
foreach($datas as $account => $data) $data->name = isset($this->users[$account]) ? $this->users[$account] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per assignedTo
|
||||
*
|
||||
* @access public
|
||||
@@ -865,15 +868,15 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerAssignedTo()
|
||||
{
|
||||
$datas = $this->dao->select('assignedTo as name, count(assignedTo) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('assignedTo')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
if(!isset($this->users)) $this->users = $this->loadModel('user')->getPairs('noletter');
|
||||
foreach($datas as $account => $data) $data->name = $this->users[$account] != '' ? $this->users[$account] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per closedReason
|
||||
*
|
||||
* @access public
|
||||
@@ -882,14 +885,14 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerClosedReason()
|
||||
{
|
||||
$datas = $this->dao->select('closedReason as name, count(closedReason) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('closedReason')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
foreach($datas as $reason => $data) $data->name = $this->lang->story->reasonList[$reason] != '' ? $this->lang->story->reasonList[$reason] : $this->lang->report->undefined;
|
||||
return $datas;
|
||||
}
|
||||
/**
|
||||
|
||||
/**
|
||||
* Get report data of storys per change
|
||||
*
|
||||
* @access public
|
||||
@@ -898,8 +901,7 @@ class storyModel extends model
|
||||
public function getDataOfStorysPerChange()
|
||||
{
|
||||
return $this->dao->select('(version-1) as name, count(*) as value')->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF($this->session->storyReport != false)->andWhere($this->session->storyReport)->fi()
|
||||
->beginIF($this->session->storyReport != false)->where($this->session->storyReport)->fi()
|
||||
->groupBy('version')->orderBy('value')->fetchAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user