diff options
author | franck cuny <franck@lumberjaph.net> | 2011-05-12 21:22:58 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2011-05-12 21:22:58 +0200 |
commit | dc7eb140af5e8b8d193d5fb1278681f7217e242a (patch) | |
tree | 11a77d28b61dd7f4525d6665c113a42446e30d20 | |
parent | Fix #65 - show the last 3 days of commits in a project (diff) | |
download | jitterbug-dc7eb140af5e8b8d193d5fb1278681f7217e242a.tar.gz |
Fix #62 - display human friendly build times
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to '')
-rw-r--r-- | Build.PL | 1 | ||||
-rw-r--r-- | lib/jitterbug/Project.pm | 10 | ||||
-rw-r--r-- | views/project/index.tt | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/Build.PL b/Build.PL index 10991a6..244c593 100644 --- a/Build.PL +++ b/Build.PL @@ -30,6 +30,7 @@ my $builder = Module::Build->new( 'App::perlbrew' => 0, 'Dist::Zilla' => 0, 'Email::Stuff' => 0, + 'Time::Elapsed' => 0, 'DBIx::Class::DeploymentHandler' => 0, }, add_to_cleanup => [ 'jitterbug-' ], diff --git a/lib/jitterbug/Project.pm b/lib/jitterbug/Project.pm index 7616843..9d57354 100644 --- a/lib/jitterbug/Project.pm +++ b/lib/jitterbug/Project.pm @@ -5,6 +5,7 @@ use Dancer::Plugin::DBIC; use jitterbug::Plugin::Template; use Digest::MD5 qw/md5_hex/; +use Time::Elapsed qw( elapsed ); use DateTime; use XML::Feed; @@ -76,8 +77,13 @@ sub _sorted_builds { my @builds; while ( my $c = $commits->next ) { - my $content = from_json($c->content); - $content->{id} = $c->sha256 if (!$content->{id}); + my $content = from_json( $c->content ); + $content->{id} = $c->sha256 if ( !$content->{id} ); + if ( $content->{build}->{start_time} ) { + $content->{time_elapsed} = + elapsed( $content->{build}->{end_time} - + $content->{build}->{start_time} ); + } push @builds, $content; } diff --git a/views/project/index.tt b/views/project/index.tt index db123c0..f8d0ea2 100644 --- a/views/project/index.tt +++ b/views/project/index.tt @@ -40,7 +40,7 @@ <: } :> <br /> <: if $commit.build.start_time { :> - built in <: $commit.build.end_time - $commit.build.start_time :> seconds + built in <: $commit.time_elapsed :> <: } else { :> running now <: } :> |