From ee8190d27d45f75e9d75a8433a702ce30690fa3d Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 4 Feb 2015 01:03:27 +0000 Subject: [PATCH] changed the unknown author handling in the code controller --- codepot/src/codepot/controllers/code.php | 30 +++++++++------------- codepot/src/codepot/views/code_diff.php | 2 +- codepot/src/codepot/views/code_history.php | 2 +- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index 5480b522..a4d733a2 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -647,21 +647,18 @@ class Code extends Controller $history = $file['history']; $history_count = count($history); - if ($type == 'commit-share-by-users') { $stats = array(); for ($i = 0; $i < $history_count; $i++) { $h = $history[$i]; - if (array_key_exists ('author', $h)) - { - $author = $h['author']; - if (array_key_exists ($author, $stats)) - $stats[$author]++; - else - $stats[$author] = 1; - } + $author = (array_key_exists ('author', $h))? $h['author']: '?'; + + if (array_key_exists ($author, $stats)) + $stats[$author]++; + else + $stats[$author] = 1; } $this->load->library ('PHPGraphLibPie', array ('width' => 400, 'height' => 300), 'graph'); @@ -677,14 +674,12 @@ class Code extends Controller for ($i = 0; $i < $history_count; $i++) { $h = $history[$i]; - if (array_key_exists ('author', $h)) - { - $author = $h['author']; - if (array_key_exists ($author, $stats)) - $stats[$author]++; - else - $stats[$author] = 1; - } + $author = (array_key_exists ('author', $h))? $h['author']: '?'; + + if (array_key_exists ($author, $stats)) + $stats[$author]++; + else + $stats[$author] = 1; } $this->load->library ('PHPGraphLib', array ('width' => 400, 'height' => 300), 'graph'); @@ -696,7 +691,6 @@ class Code extends Controller $this->graph->setBars(TRUE); //$this->graph->setXValuesHorizontal(TRUE); $this->graph->createGraph(); - } } diff --git a/codepot/src/codepot/views/code_diff.php b/codepot/src/codepot/views/code_diff.php index 98a17dc0..cf9d0313 100644 --- a/codepot/src/codepot/views/code_diff.php +++ b/codepot/src/codepot/views/code_diff.php @@ -184,7 +184,7 @@ if (FALSE) // don't want to delete code for the original diff view. { print ''; /* - print '
';	
+	print '
';
 	print_r ($file['content']);
 	print '
'; */ diff --git a/codepot/src/codepot/views/code_history.php b/codepot/src/codepot/views/code_history.php index a827aa2b..e2f0c1e4 100644 --- a/codepot/src/codepot/views/code_history.php +++ b/codepot/src/codepot/views/code_history.php @@ -135,7 +135,7 @@ $this->load->view ( print ''; - if ($file['type'] == 'file') + if ($file['type'] == 'file') { print '
'; print anchor ("code/blame/{$project->id}/{$xfullpath}/{$h['rev']}",