1
0

Updated ExtendedGitGraph version

This commit is contained in:
Mike Schwörer 2014-12-29 23:19:40 +01:00
parent 315f37c826
commit 7a7437e6d3
3 changed files with 371 additions and 282 deletions

View File

@ -14,6 +14,8 @@ class ExtendedGitGraph {
const PROGRESS_SESSION_COOKIE = 'ajax_progress_egh_refresh'; const PROGRESS_SESSION_COOKIE = 'ajax_progress_egh_refresh';
const COMMITCOUNT_COLOR_UPPERLIMIT = 16;
private $username; private $username;
private $token; private $token;
private $tokenHeader; private $tokenHeader;
@ -243,7 +245,7 @@ class ExtendedGitGraph {
public function generate($year) { public function generate($year) {
$ymap = $this->generateYearMap($year); // unused on purpose (template.php needs it) $ymap = $this->generateYearMap($year); // unused on purpose (template.php needs it)
$ymapmax = $this->getMaxCommitCount(); // unused on purpose (template.php needs it) $ymapmax = min($this->getMaxCommitCount(), self::COMMITCOUNT_COLOR_UPPERLIMIT); // unused on purpose (template.php needs it)
ob_start(); ob_start();
include('template.php'); include('template.php');

View File

@ -49,7 +49,7 @@ $monthlist = array_fill(0, 12, [0, 0]);
} }
$c_count = $ymap[$date->format('Y-m-d')]; $c_count = $ymap[$date->format('Y-m-d')];
$color_idx = ceil(pow($c_count/$ymapmax, $exponent) * (count($COLORS)-1)); $color_idx = min((count($COLORS)-1), ceil(pow($c_count/$ymapmax, $exponent) * (count($COLORS)-1)));
$color = $COLORS[$color_idx]; $color = $COLORS[$color_idx];
$wday = ($date->format('N') - 1); $wday = ($date->format('N') - 1);

File diff suppressed because one or more lines are too long