From 04c534936ebb2d83df8ba7d9d7216a41970c9965 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 5 Jun 2015 14:49:58 +0800 Subject: [PATCH] * fix a bug. --- module/cron/config.php | 2 +- module/cron/model.php | 2 +- module/project/control.php | 6 +++--- module/report/model.php | 18 ++++++++++++++++-- module/story/model.php | 2 +- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/module/cron/config.php b/module/cron/config.php index ba0f7835e1..78447c9212 100644 --- a/module/cron/config.php +++ b/module/cron/config.php @@ -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; diff --git a/module/cron/model.php b/module/cron/model.php index 57c6d8e249..8d2056735d 100644 --- a/module/cron/model.php +++ b/module/cron/model.php @@ -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; diff --git a/module/project/control.php b/module/project/control.php index 4dfbe65edb..1d9a18b408 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -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; diff --git a/module/report/model.php b/module/report/model.php index 89df41f9c0..0cce18cd20 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -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. * diff --git a/module/story/model.php b/module/story/model.php index c75f4c544d..77ae73e4d0 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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)