about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-05-12 21:22:58 +0200
committerfranck cuny <franck@lumberjaph.net>2011-05-12 21:22:58 +0200
commitdc7eb140af5e8b8d193d5fb1278681f7217e242a (patch)
tree11a77d28b61dd7f4525d6665c113a42446e30d20 /lib
parentFix #65 - show the last 3 days of commits in a project (diff)
downloadjitterbug-dc7eb140af5e8b8d193d5fb1278681f7217e242a.tar.gz
Fix #62 - display human friendly build times
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/jitterbug/Project.pm10
1 files changed, 8 insertions, 2 deletions
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;
     }