touched up the commits-per-month graph
This commit is contained in:
		| @ -791,9 +791,12 @@ class Code extends Controller | |||||||
| 			$file = $this->subversion->getHistory ($projectid, $path, SVN_REVISION_HEAD); | 			$file = $this->subversion->getHistory ($projectid, $path, SVN_REVISION_HEAD); | ||||||
| 			if ($file === FALSE) | 			if ($file === FALSE) | ||||||
| 			{ | 			{ | ||||||
| 				header($_SERVER['SERVER_PROTOCOL'].' 500 Internal Server Error');  | 				//header($_SERVER['SERVER_PROTOCOL'].' 500 Internal Server Error');  | ||||||
| 				return; | 				//return; | ||||||
|  | 				$stats = array ('no-data' => 0); | ||||||
| 			} | 			} | ||||||
|  | 			else  | ||||||
|  | 			{	 | ||||||
| 	 | 	 | ||||||
| 				$history = $file['history']; | 				$history = $file['history']; | ||||||
| 				$history_count = count($history); | 				$history_count = count($history); | ||||||
| @ -823,11 +826,13 @@ class Code extends Controller | |||||||
| 						$min_year = substr($k, 0, 4); | 						$min_year = substr($k, 0, 4); | ||||||
| 						$min_month = substr($k, 5, 2); | 						$min_month = substr($k, 5, 2); | ||||||
| 					} | 					} | ||||||
| 				else if ($idx == $stats_count)  | 	 | ||||||
|  | 					if ($idx == $stats_count)  | ||||||
| 					{ | 					{ | ||||||
| 						$max_year = substr($k, 0, 4); | 						$max_year = substr($k, 0, 4); | ||||||
| 						$max_month = substr($k, 5, 2); | 						$max_month = substr($k, 5, 2); | ||||||
| 					} | 					} | ||||||
|  | 	 | ||||||
| 					$idx++;	 | 					$idx++;	 | ||||||
| 				}	 | 				}	 | ||||||
| 	 | 	 | ||||||
| @ -836,7 +841,7 @@ class Code extends Controller | |||||||
| 					$month = ($year == $min_year)? $min_month: 1; | 					$month = ($year == $min_year)? $min_month: 1; | ||||||
| 					$month_end = ($year == $max_year)? $max_month: 12; | 					$month_end = ($year == $max_year)? $max_month: 12; | ||||||
| 	 | 	 | ||||||
| 				while ($month < $month_end) | 					while ($month <= $month_end) | ||||||
| 					{ | 					{ | ||||||
| 						$date = sprintf ("%04d-%02d", $year, $month); | 						$date = sprintf ("%04d-%02d", $year, $month); | ||||||
| 	 | 	 | ||||||
| @ -849,10 +854,11 @@ class Code extends Controller | |||||||
| 						$month++; | 						$month++; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			ksort ($stats); | 			ksort ($stats); | ||||||
| 			$stats_count = count($stats); | 			$stats_count = count($stats); | ||||||
|  |  | ||||||
| 			$graph_width = $stats_count * 5; | 			$graph_width = $stats_count * 5; | ||||||
| 			if ($graph_width < 400) $graph_width = 400; | 			if ($graph_width < 400) $graph_width = 400; | ||||||
| 			$this->load->library ('PHPGraphLib', array ('width' => $graph_width, 'height' => 150), 'graph'); | 			$this->load->library ('PHPGraphLib', array ('width' => $graph_width, 'height' => 150), 'graph'); | ||||||
| @ -864,8 +870,19 @@ class Code extends Controller | |||||||
| 			$this->graph->setLineColor("red"); | 			$this->graph->setLineColor("red"); | ||||||
| 			$this->graph->setBars(FALSE); | 			$this->graph->setBars(FALSE); | ||||||
| 			$this->graph->setXValues(TRUE); | 			$this->graph->setXValues(TRUE); | ||||||
| 			$this->graph->setXValuesInterval(12); |  | ||||||
| 			$this->graph->setXValuesHorizontal(TRUE); | 			$this->graph->setXValuesHorizontal(TRUE); | ||||||
|  | 			if ($stats_count < 12) | ||||||
|  | 			{ | ||||||
|  | 				if ($stats_count <= 1) | ||||||
|  | 				{ | ||||||
|  | 					$this->graph->setDataPoints(TRUE); | ||||||
|  | 					$this->graph->setDataPointColor("red"); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				$this->graph->setXValuesInterval(11); | ||||||
|  | 			} | ||||||
| 			$this->graph->setGrid(FALSE); | 			$this->graph->setGrid(FALSE); | ||||||
| 			$this->graph->createGraph(); | 			$this->graph->createGraph(); | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user