handled a corner case of no author in the code history

This commit is contained in:
hyung-hwan 2015-02-03 13:06:04 +00:00
parent 4a2a119bec
commit c31e4aebb8

View File

@ -654,10 +654,14 @@ class Code extends Controller
for ($i = 0; $i < $history_count; $i++) for ($i = 0; $i < $history_count; $i++)
{ {
$h = $history[$i]; $h = $history[$i];
if (array_key_exists ($h['author'], $stats)) if (array_key_exists ('author', $h))
$stats[$h['author']]++; {
else $author = $h['author'];
$stats[$h['author']] = 1; if (array_key_exists ($author, $stats))
$stats[$author]++;
else
$stats[$author] = 1;
}
} }
$this->load->library ('PHPGraphLibPie', array ('width' => 400, 'height' => 300), 'graph'); $this->load->library ('PHPGraphLibPie', array ('width' => 400, 'height' => 300), 'graph');
@ -673,10 +677,14 @@ class Code extends Controller
for ($i = 0; $i < $history_count; $i++) for ($i = 0; $i < $history_count; $i++)
{ {
$h = $history[$i]; $h = $history[$i];
if (array_key_exists ($h['author'], $stats)) if (array_key_exists ('author', $h))
$stats[$h['author']]++; {
else $author = $h['author'];
$stats[$h['author']] = 1; if (array_key_exists ($author, $stats))
$stats[$author]++;
else
$stats[$author] = 1;
}
} }
$this->load->library ('PHPGraphLib', array ('width' => 400, 'height' => 300), 'graph'); $this->load->library ('PHPGraphLib', array ('width' => 400, 'height' => 300), 'graph');