* fix a bug.

This commit is contained in:
wangyidong
2015-06-05 14:49:58 +08:00
parent 17dc7e986b
commit 04c534936e
5 changed files with 22 additions and 8 deletions
+1 -1
View File
@@ -6,4 +6,4 @@ $config->cron->create->requiredFields = 'm,h,dom,mon,dow,command';
$config->cron->edit->requiredFields = 'm,h,dom,mon,dow,command';
$config->cron->maxRunDays = 8;
$config->cron->maxRunTime = 1800;
$config->cron->maxRunTime = 180;
+1 -1
View File
@@ -135,7 +135,7 @@ class cronModel extends model
if(empty($this->config->global->cron)) return false;
$lastTime = $this->getLastTime();
if($lastTime == '0000-00-00 00:00:00' or ((time() - strtotime($lastTime)) > $this->config->cron->maxRunTime)) return true;
if($lastTime == '0000-00-00 00:00:00' or ((time() - strtotime($lastTime)) >= 65)) return true;
if(!isset($this->config->cron->run->status)) return true;
if($this->config->cron->run->status == 'stop') return true;
+3 -3
View File
@@ -729,7 +729,7 @@ class project extends control
$position[] = $this->lang->project->burn;
/* Get date list. */
list($dateList, $interval) = $this->project->getDateList($projectInfo->begin, $projectInfo->end, $type, $interval, 'j/n');
list($dateList, $interval) = $this->project->getDateList($projectInfo->begin, $projectInfo->end, $type, $interval, 'Y-m-d');
$sets = $this->project->getBurnDataFlot($project->id);
$limitJSON = '[]';
@@ -738,12 +738,12 @@ class project extends control
$firstBurn = empty($sets) ? 0 : reset($sets);
$firstTime = isset($firstBurn->value) ? $firstBurn->value : 0;
$days = count($dateList) - 1;
$rate = $firstTime / $days;
$rate = round($firstTime / $days, 2);
$baselineJSON = '[';
foreach($dateList as $i => $date) $baselineJSON .= ($days - $i) * $rate . ',';
$baselineJSON = rtrim($baselineJSON, ',') . ']';
$chartData['labels'] = $dateList;
$chartData['labels'] = $this->report->convertFormat($dateList, 'j/n');
$chartData['burnLine'] = $this->report->createSingleJSON($sets, $dateList);
$chartData['baseLine'] = $baselineJSON;
+16 -2
View File
@@ -39,14 +39,28 @@ class reportModel extends model
$data = '[';
foreach($dateList as $i => $date)
{
$date = date('Y-m-d', strtotime($date));
if(isset($sets[$date]))$data .= "[$i, {$sets[$date]->value}],";
$date = date('Y-m-d', strtotime($date));
$data .= isset($sets[$date]) ? "{$sets[$date]->value}," : "'',";
}
$data = rtrim($data, ',');
$data .= ']';
return $data;
}
/**
* Convert date format.
*
* @param array $dateList
* @param string $format
* @access public
* @return array
*/
public function convertFormat($dateList, $format = 'Y-m-d')
{
foreach($dateList as $i => $date) $dateList[$i] = date($format, strtotime($date));
return $dateList;
}
/**
* Get projects.
*
+1 -1
View File
@@ -1183,7 +1183,7 @@ class storyModel extends model
*/
public function getProjectStories($projectID = 0, $orderBy = 'pri_asc,id_desc', $type = 'byModule', $param = 0)
{
if($type == 'byModule' and $param) $modules = $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$param,%")->andWhere('type')->eq('story')->fetchPairs('id', 'id');
$modules = ($type == 'byModule' and $param) ? $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$param,%")->andWhere('type')->eq('story')->fetchPairs('id', 'id') : array();
$stories = $this->dao->select('t1.*, t2.*')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->where('t1.project')->eq((int)$projectID)