Skip to content

Commit

Permalink
Tidying up
Browse files Browse the repository at this point in the history
  • Loading branch information
ranginui committed Jul 13, 2012
1 parent 99b333b commit 562b75e
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/KC/Dashboard.pm
Expand Up @@ -35,31 +35,35 @@ get '/' => sub {
$sth = database->prepare($sql) or die database->errstr; $sth = database->prepare($sql) or die database->errstr;
$sth->execute or die $sth->errstr; $sth->execute or die $sth->errstr;
my $stats = $sth->fetchall_arrayref; my $stats = $sth->fetchall_arrayref;
$sql = "SELECT count(*) as count ,subdate(current_date, 1) as day FROM bugs_activity WHERE date(bug_when) = subdate(current_date, 1);"; $sql =
"SELECT count(*) as count ,subdate(current_date, 1) as day FROM bugs_activity WHERE date(bug_when) = subdate(current_date, 1);";
$sth = database->prepare($sql) or die database->errstr; $sth = database->prepare($sql) or die database->errstr;
$sth->execute or die $sth->errstr; $sth->execute or die $sth->errstr;
my $yesterday = $sth->fetchrow_hashref(); my $yesterday = $sth->fetchrow_hashref();
$sql = "SELECT count(*) as count, current_date as day FROM bugs_activity WHERE date(bug_when) = current_date;"; $sql =
"SELECT count(*) as count, current_date as day FROM bugs_activity WHERE date(bug_when) = current_date;";
$sth = database->prepare($sql) or die database->errstr; $sth = database->prepare($sql) or die database->errstr;
$sth->execute or die $sth->errstr; $sth->execute or die $sth->errstr;
my $today = $sth->fetchrow_hashref(); my $today = $sth->fetchrow_hashref();
$sql = "SELECT count(*) as count ,subdate(current_date, 2) as day FROM bugs_activity WHERE date(bug_when) = subdate(current_date, 2);"; $sql =
"SELECT count(*) as count ,subdate(current_date, 2) as day FROM bugs_activity WHERE date(bug_when) = subdate(current_date, 2);";
$sth = database->prepare($sql) or die database->errstr; $sth = database->prepare($sql) or die database->errstr;
$sth->execute or die $sth->errstr; $sth->execute or die $sth->errstr;
my $daybefore = $sth->fetchrow_hashref(); my $daybefore = $sth->fetchrow_hashref();
$sql = "SELECT bugs.bug_id,short_desc FROM bugs,bugs_activity WHERE bugs.bug_id = bugs_activity.bug_id $sql =
"SELECT bugs.bug_id,short_desc FROM bugs,bugs_activity WHERE bugs.bug_id = bugs_activity.bug_id
AND added = 'Pushed to Master' AND bug_severity = 'enhancement' ORDER BY bug_when desc LIMIT 5"; AND added = 'Pushed to Master' AND bug_severity = 'enhancement' ORDER BY bug_when desc LIMIT 5";
$sth = database->prepare($sql) or die database->errstr; $sth = database->prepare($sql) or die database->errstr;
$sth->execute or die $sth->errstr; $sth->execute or die $sth->errstr;
my $enhancement = $sth->fetchall_arrayref; my $enhancement = $sth->fetchall_arrayref;

template 'show_entries.tt', template 'show_entries.tt',
{ {
'entries' => $entries, 'entries' => $entries,
'stats' => $stats, 'stats' => $stats,
'yesterday' => $yesterday, 'yesterday' => $yesterday,
'today' => $today, 'today' => $today,
'daybefore' => $daybefore, 'daybefore' => $daybefore,
'enhancments' => $enhancement, 'enhancments' => $enhancement,
}; };
}; };
Expand Down

0 comments on commit 562b75e

Please sign in to comment.